Hello,
yesterday I installed the latest Visual Studio 2019 update and now I'm getting in the line
var dllStream = currentAssembly.GetManifestResourceStream(fullDllName);
a value of null (called in CurrentDomain_AssemblyResolve()). It was working good all the time.
I'm using the code posted here:
https://www.telerik.com/forums/how-to-display-controls-(like-radwindow)-at-design-time-when-noxaml-is-used-and-implicit-style-resources-are-in-a-custom-dll#Pz5cUcqhtk-t3EQHJuJYHg
public class TelerikThemeUtilities{ static TelerikThemeUtilities() { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; } public static void Initialize() { } public static bool GetDesignTime(DependencyObject obj) { return (bool)obj.GetValue(DesignTimeProperty); } public static void SetDesignTime(DependencyObject obj, bool value) { obj.SetValue(DesignTimeProperty, value); } public static readonly DependencyProperty DesignTimeProperty = DependencyProperty.RegisterAttached( "DesignTime", typeof(bool), typeof(TelerikThemeUtilities), new PropertyMetadata(false, DesignTimeChanged)); private static void DesignTimeChanged(DependencyObject target, DependencyPropertyChangedEventArgs args) { if (((bool)args.NewValue) && System.ComponentModel.DesignerProperties.GetIsInDesignMode(target)) { FrameworkElement element = target as FrameworkElement; LoadTelerikTheme(element.Resources, "Crystal"); } } public static void LoadTelerikTheme(string themeName) { Application.Current.Resources.Clear(); LoadTelerikTheme(Application.Current.Resources, themeName); } private static void LoadTelerikTheme(ResourceDictionary resources, string themeName) { resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute) }); resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/Telerik.Windows.Controls.Input.xaml", UriKind.RelativeOrAbsolute) }); resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/Telerik.Windows.Controls.Navigation.xaml", UriKind.RelativeOrAbsolute) }); resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/Telerik.Windows.Controls.GridView.xaml", UriKind.RelativeOrAbsolute) }); resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("/Telerik.Windows.Themes." + themeName + ";component/Themes/Telerik.Windows.Documents.xaml", UriKind.RelativeOrAbsolute) }); } private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { var dllName = args.Name.Substring(0, args.Name.IndexOf(',')) + ".dll"; if (dllName.Contains("Telerik")) { var currentAssembly = System.Reflection.Assembly.GetExecutingAssembly(); var fullDllName = currentAssembly.GetName().Name + ".lib." + dllName; var dllStream = currentAssembly.GetManifestResourceStream(fullDllName); var streamBytes = new byte[dllStream.Length]; dllStream.Read(streamBytes, 0, streamBytes.Length); var requestedAssembly = System.Reflection.Assembly.Load(streamBytes); return requestedAssembly; } else { return null; } } }}
- $exception {"Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."} System.NullReferenceException+ Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal} HResult -2147467261 int HelpLink null string+ InnerException null System.Exception Message "Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt." string Source "PsShell" string StackTrace " bei PsShell.TelerikThemeUtilities.CurrentDomain_AssemblyResolve(Object sender, ResolveEventArgs args) in C:\\Projects\\PSV\\PSV-Client\\source\\PsShell\\TelerikThemeUtilities.cs: Zeile64" string+ TargetSite {System.Reflection.Assembly CurrentDomain_AssemblyResolve(System.Object, System.ResolveEventArgs)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}+ Statische Member + Nicht öffentliche Member + sender {Name:PsShell.exeKeine Kontextrichtlinien vorhanden.} object {System.AppDomain}+ args {System.ResolveEventArgs} System.ResolveEventArgs dllName "Telerik.Windows.Controls.resources.dll" string+ currentAssembly {PsShell, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null} System.Reflection.Assembly {System.Reflection.RuntimeAssembly} fullDllName "PsShell.lib.Telerik.Windows.Controls.resources.dll" string+ dllStream null System.IO.Stream streamBytes null byte[] requestedAssembly null System.Reflection.Assembly
Any ideas?
Best Regards,
Raul