Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Issue: Unable to load several versions of the toolkit into the same AppDomain [19433]

$
0
0
Hello,

We have a software which allows to add custom features by plugins. Plugins may add their own GUI with own panels, controls, etc. For different reasons it is essential that all plugins and the host software run in the same AppDomain. We recently got into the situation where two plugins used a different version of the WPF toolkit. In this scenario every time a panel was opened which contained a WPF toolkit control the software stopped working because of a missing resource. It turned out that the wrong version of the toolkit was used to resolve the resource.

After digging further into the issue we could locate the root cause in the merged resource dictionary in Main\Source\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.Toolkit\Themes\Generic.xaml:

The merged resource dictionary doesn't specify a specific version for the other resource dictionaries. So the fix which worked for us is to change it from:
```
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Xceed.Wpf.Toolkit;component/Themes/Generic/Brushes.xaml" />
<ResourceDictionary Source="/Xceed.Wpf.Toolkit;component/Themes/Generic/Buttons.xaml" />
...
</ResourceDictionary.MergedDictionaries>
```

to:
```
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Xceed.Wpf.Toolkit;v1.9.0.0;component/Themes/Generic/Brushes.xaml" />
<ResourceDictionary Source="/Xceed.Wpf.Toolkit;v1.9.0.0;component/Themes/Generic/Buttons.xaml" />
...
</ResourceDictionary.MergedDictionaries>
```

This way the correct version of the resources will be resolved. The full solution would likely include a way to insert the current assembly version where I hard coded 1.9.0.0.

Would it be possible to add this fix to one of the next releases?

Best regards
Christian
Comments: ** Comment from web user: chrilieb **

Thanks for your fast response.

I had hoped that there is a way in XAML to use the version in _XceedVersionInfo and insert that into the source string. Unfortunately I couldn't find a way to get that working especially because ResourceDictionary is not a dependency object (sometimes the small things are difficult in XAML).

Perhaps there is a way to create the resource dictionary from c# code like described here [1]. An alternative may be to edit the XAML file in a MSBuild step before the compilation takes place. I'm not sure if I like any of those two options. But I will think about it some more.

Here is a related issue which brought me to the solution posted in the issue description: [2].

Regards
Christian

[1] http://social.msdn.microsoft.com/Forums/is/wpf/thread/49018f5d-f802-426c-b2a0-b36df90b379d
[2] http://stackoverflow.com/questions/1453107/how-to-force-wpf-to-use-resource-uris-that-use-assembly-strong-name-argh


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>