Browse Source

Fix Design.IsDesignMode being false in BuildAvaloniaApp method (#13699)

pull/13705/head
Tako 3 years ago
committed by GitHub
parent
commit
0c25e67d7f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/Avalonia.DesignerSupport/Remote/RemoteDesignerEntryPoint.cs

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

@ -173,13 +173,11 @@ namespace Avalonia.DesignerSupport.Remote
if (transport is ITransportWithEnforcedMethod enforcedMethod)
args.Method = enforcedMethod.PreviewerMethod;
var asm = Assembly.LoadFile(System.IO.Path.GetFullPath(args.AppPath));
var entryPoint = asm.EntryPoint;
if (entryPoint == null)
throw Die($"Assembly {args.AppPath} doesn't have an entry point");
var entryPoint = asm.EntryPoint ?? throw Die($"Assembly {args.AppPath} doesn't have an entry point");
Log($"Initializing application in design mode");
Design.IsDesignMode = true;
Log($"Obtaining AppBuilder instance from {entryPoint.DeclaringType!.FullName}");
var appBuilder = AppBuilder.Configure(entryPoint.DeclaringType);
Design.IsDesignMode = true;
Log($"Initializing application in design mode");
var initializer =(IAppInitializer)Activator.CreateInstance(typeof(AppInitializer));
transport = initializer.ConfigureApp(transport, args, appBuilder);
s_transport = transport;

Loading…
Cancel
Save