Browse Source

Fix Previewer crash from Refit reflection (#14282) (#14301)

pull/14329/head
Mayka Macinkowicz 2 years ago
committed by GitHub
parent
commit
a412c8d4cc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/Avalonia.DesignerSupport/DesignWindowLoader.cs
  2. 2
      src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs

2
src/Avalonia.DesignerSupport/DesignWindowLoader.cs

@ -35,7 +35,7 @@ namespace Avalonia.DesignerSupport
new Uri($"avares://{Path.GetFileNameWithoutExtension(assemblyPath)}{xamlFileProjectPath}");
}
var localAsm = assemblyPath != null ? Assembly.LoadFile(Path.GetFullPath(assemblyPath)) : null;
var localAsm = assemblyPath != null ? Assembly.LoadFrom(Path.GetFullPath(assemblyPath)) : null;
var useCompiledBindings = localAsm?.GetCustomAttributes<AssemblyMetadataAttribute>()
.FirstOrDefault(a => a.Key == "AvaloniaUseCompiledBindingsByDefault")?.Value;

2
src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs

@ -172,7 +172,7 @@ namespace Avalonia.DesignerSupport.Remote
var transport = CreateTransport(args);
if (transport is ITransportWithEnforcedMethod enforcedMethod)
args.Method = enforcedMethod.PreviewerMethod;
var asm = Assembly.LoadFile(System.IO.Path.GetFullPath(args.AppPath));
var asm = Assembly.LoadFrom(System.IO.Path.GetFullPath(args.AppPath));
var entryPoint = asm.EntryPoint ?? throw Die($"Assembly {args.AppPath} doesn't have an entry point");
Log($"Initializing application in design mode");
Design.IsDesignMode = true;

Loading…
Cancel
Save