Browse Source

Switch to the Avalonia 12 DevTools (WithDeveloperTools) bridge

Avalonia 12 dropped the in-process Avalonia.Diagnostics package (its last
release is 11.3.x), so AttachDevTools no longer shows a window. Move to the
AvaloniaUI.DiagnosticsSupport bridge driven by WithDeveloperTools() in
BuildAvaloniaApp -- it attaches internally, so a separate App-level
AttachDeveloperTools call would double-attach and throw. The inspector is the
AvaloniaUI.DeveloperTools global tool (avdt) connecting over the bridge.
DEBUG-only: the assets are dropped from Release builds.

Assisted-by: Claude:claude-opus-4-8:Claude Code
pull/3755/head
Siegfried Pammer 1 month ago
parent
commit
002742c07e
  1. 4
      ILSpy/ILSpy.csproj
  2. 15
      ILSpy/Program.cs

4
ILSpy/ILSpy.csproj

@ -67,6 +67,10 @@ @@ -67,6 +67,10 @@
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Themes.Simple" />
<PackageReference Include="Svg.Controls.Skia.Avalonia" />
<!-- Avalonia 12 DevTools: the in-app bridge half. Pairs with the AvaloniaUI.DeveloperTools
global tool (the inspector UI process) that connects over this bridge. DEBUG-only: the
assets are dropped in Release so nothing diagnostic ships. The matching WithDeveloperTools
and AttachDeveloperTools calls live in Program.cs / App.axaml.cs, also under #if DEBUG. -->
<PackageReference Include="AvaloniaUI.DiagnosticsSupport">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>

15
ILSpy/Program.cs

@ -33,8 +33,17 @@ namespace ILSpy @@ -33,8 +33,17 @@ namespace ILSpy
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
{
var builder = AppBuilder.Configure<App>()
.UsePlatformDetect();
#if DEBUG
// Enables and attaches the Avalonia 12 DevTools bridge (it calls AttachDeveloperTools
// internally, so no separate App-level attach is needed -- a second call throws
// "already attached"). The avdt global tool connects over this bridge. Gated on DEBUG
// because the DiagnosticsSupport assets are excluded from Release.
builder = builder.WithDeveloperTools();
#endif
return builder.LogToTrace();
}
}
}
Loading…
Cancel
Save