EgorBo / Disasmo

VS2022 Add-in. Click on any method or class to see what .NET Core's JIT generates for them (ASM).
MIT License
638 stars 39 forks source link

net8.0 (preview 7) does not appear to be supported #45

Open nietras opened 1 year ago

nietras commented 1 year ago

@EgorBo trying to use Disasmo with .NET 8.0 preview 7 but this appears to not work.

Unhandled exception. System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Project has

<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
EgorBo commented 1 year ago

I can't repro, can you please try again on a new console app and share the logs? (you can click "clear" first to remove previous lines). Also, can you show you Settings tab?

nietras commented 1 year ago

I will try that later, but I figured out the issue disappears if no longer multi targeting and just having e. g. net8.0 as target. I had the issue on two PCs one where disasmo was just installed.

xoofx commented 11 months ago

Similarly, if I multitarget (net7.0 and net8.0) with latest 8.0.100-rc.1.23463.5 and I'm getting a similar error:

Unhandled exception. System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at DisasmoLoader.PrecompileAllMethodsInType(String[] args)
   at DisasmoLoader.Main(String[] args)

The log gives me:

Executing a command in directory "C:\code\tmp\TestDebugging\TestDebugging":
    dotnet build -f net8.0 -c Release -o bin\Release\net7.0\Disasmo-v5.7.5 --no-self-contained /p:RuntimeIdentifier="" /p:RuntimeIdentifiers="" /p:WarningLevel=0 /p:TreatWarningsAsErrors=false "C:\code\tmp\TestDebugging\TestDebugging\TestDebugging.csproj"
Env.vars:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
DOTNET_CLI_TELEMETRY_OPTOUT=1

Executing a command in directory "":
    dotnet --version
Env.vars:

dotnet --version: 8.0.100-rc.1.23463.5 ()
LoaderAppManager.GetPathToLoader: 5.7.5_net8.0_8.0.100-rc.1.23463.5

Executing a command in directory "C:\code\tmp\TestDebugging\TestDebugging\bin\Release\net7.0\Disasmo-v5.7.5":
    dotnet "DisasmoLoader4.dll" "TestDebugging.dll" "TestDebugging.Program" "Tester2" False
Env.vars:
DOTNET_JitDisasm=*Program:Tester2
DOTNET_TieredPGO=0
DOTNET_TieredCompilation=0
DOTNET_JitDiffableDasm=0
DOTNET_ReadyToRun=1
DOTNET_TieredPGO_InstrumentOnlyHotCode=0
DOTNET_TC_CallCountingDelayMs=0
EgorBo commented 11 months ago

@xoofx ah, thanks for the feedback, by multi-target do you mean:

<TargetFrameworks>net8.0;net7.0</TargetFrameworks>

? I see from the log that the app is being built with net7.0 🤔

xoofx commented 11 months ago

Yeah, it is working with:

<TargetFrameworks>net8.0;net7.0</TargetFrameworks>

But not with:

<TargetFrameworks>net7.0;net8.0</TargetFrameworks> 

It's basically not possible to test net7.0 and net8.0 from the same app. Sometimes you want to compare the codegen easily, but the only way is to have a single TargetFramework and change it between the calls.

Wondering how much trouble it would be to support selecting the TargetFramework from disasmo? (I could try to make a PR)

EgorBo commented 11 months ago

Ah I see, as a quick fix I put a textbox at the bottom of the Disasmo view to specify custom TFM (empty means "auto") - image

via https://github.com/EgorBo/Disasmo/commit/cc6c2d3b2db2f50d1f8dfeb255784365aa6f4677 and already published 5.9.0 build

(I could try to make a PR)

The code in the add-in is quite messy, I want to allocate a day or two to rewrite it 🙂

xoofx commented 11 months ago

Thanks for the fix... though, I just tried, and it seems that it is still using only .NET 8.0. If I change to net7.0 (in the TargetFramework box that you provide), the code gen is the same, but If I disable multi-targeting and force a single TargetFramework net7.0, it compiles with net7.0 as expected.

So there is maybe something not working.

Also, when I change the order of the TargetFramework in the csproj back to net7.0;net8.0 I still get an exception:

image

The log shows that it is trying to use net7.0 despite selecting net8.0 in the box:


Executing a command in directory "C:\code\tmp\TestDebugging\TestDebugging":
    dotnet build -f net8.0 -c Release -o bin\Release\net7.0\Disasmo-v5.9.0 --no-self-contained /p:RuntimeIdentifier="" /p:RuntimeIdentifiers="" /p:WarningLevel=0 /p:TreatWarningsAsErrors=false "C:\code\tmp\TestDebugging\TestDebugging\TestDebugging.csproj"
Env.vars:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
DOTNET_CLI_TELEMETRY_OPTOUT=1

Executing a command in directory "":
    dotnet --version
Env.vars:

dotnet --version: 8.0.100-rc.1.23463.5 ()
LoaderAppManager.GetPathToLoader: 5.9.0_net8.0_8.0.100-rc.1.23463.5

Executing a command in directory "C:\code\tmp\TestDebugging\TestDebugging\bin\Release\net7.0\Disasmo-v5.9.0":
    dotnet "DisasmoLoader4.dll" "TestDebugging.dll" "TestDebugging.Program" "Tester" False
Env.vars:
DOTNET_JitDisasm=*Program:Tester
DOTNET_TieredPGO=0
DOTNET_TieredCompilation=0
DOTNET_JitDiffableDasm=0
DOTNET_ReadyToRun=1
DOTNET_TieredPGO_InstrumentOnlyHotCode=0
DOTNET_TC_CallCountingDelayMs=0