Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application doesn't work when resource directory contains relative resource #550

Open
ryanroe opened this issue May 21, 2024 · 0 comments · May be fixed by #551
Open

Application doesn't work when resource directory contains relative resource #550

ryanroe opened this issue May 21, 2024 · 0 comments · May be fixed by #551
Labels
potential-bug Something does not seem to be working triage This issue needs some initial analysis.

Comments

@ryanroe
Copy link

ryanroe commented May 21, 2024

  • ConfuserEx Version: 1.6.0+447341964f
  • Target Framework: .Net Framework 4.6
  • Operating System: Windows 11 Pro

Steps to Reproduce:

  1. create an empty WPF Application( .Net Framework )
  2. make it Console Application (to see the error info after obfuscated)
  3. create as the following image
    resource_test

contents of Color.xaml

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <SolidColorBrush x:Key="PrimaryBrush" Color="Red" />
</ResourceDictionary>

contents of Skin.xaml

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="./Color.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

contents of App.xaml

<Application
    x:Class="WpfRelativeResourceTest.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfRelativeResourceTest"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="./Themes/Skin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

contents of MainWindow.xaml

<Window
    x:Class="WpfRelativeResourceTest.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:WpfRelativeResourceTest"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MainWindow"
    Width="800"
    Height="450"
    mc:Ignorable="d">
    <Grid Background="{DynamicResource PrimaryBrush}" />
</Window>
  1. obfuscate this with only rename feature on
	<rule pattern="true" inherit="false">
		<protection id="rename" />
	</rule>
	<rule pattern="namespace('WpfRelativeResourceTest') and name('App')" inherit="false">
		<protection id="rename" action="remove" />
	</rule>
  1. app throws exception (can't find themes/color.xaml)
@ryanroe ryanroe added potential-bug Something does not seem to be working triage This issue needs some initial analysis. labels May 21, 2024
ryanroe added a commit to ryanroe/ConfuserEx that referenced this issue May 21, 2024
@ryanroe ryanroe linked a pull request May 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
potential-bug Something does not seem to be working triage This issue needs some initial analysis.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant