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

New Post: ResourceDictionary relative path issue with .NET 4.6

$
0
0
Description

A project that targets .NET Framework 4.6 and that is compiled with Visual Studio 2015 may crash when it references Xceed Extended WPF Toolkit Community Edition v2.4 and earlier. The exception thrown may contain a message that looks like “Initialization of ‘AssemblyName’ threw an exception.”

The issue arises because of the use an URI format for ResourceDictionary that's no longer recognized by the parser in .NET Framework 4.6. This is fixed in Xceed Extended WPF Toolkit v2.5 Community Edition on NuGet and CodePlex and Plus Edition v2.7 on Xceed.com.

Manual fix for Xceed Extended WPF Toolkit versions 2.4 and before:

A new binary version of the assemblies must be compiled from the source code. The lines of code to change are located in:

File: Xceed.Wpf.Toolkit/Core/VersionResourceDictionary.cs

Method: ISupportInitialize.EndInit()

Lines to change:

string uriStr = string.Format( @"{0};v{1};component/{2}", this.AssemblyName, _XceedVersionInfo.Version, this.SourcePath );

this.Source = new Uri( uriStr, UriKind.Relative );

Lines to use instead:

string uriStr = string.Format( @"pack://application:,,,/{0};v{1};component/{2}", this.AssemblyName, _XceedVersionInfo.Version, this.SourcePath );

this.Source = new Uri( uriStr, UriKind.Absolute );

Viewing all articles
Browse latest Browse all 4964