Repository navigation
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Hi,
I have .net core 6.0 application, when I run it from visual studio, it run normally without any problem, when I do building it natively it's not working
I am using the following command, to build the project
dotnet publish -c Release -r win-x64
What I noticed, when I do normal build from VS2022, the System.Net.Quic version loaded to the build folder is 6.0.0.0, on native build, the app trying to load version 7.0.0.0
kindly check the image below, not sure if this is the right section for posting this.
Expected Behavior
Running the app in native mode
Steps To Reproduce
No response
Exceptions (if any)
System.TypeLoadException: Could not load type 'System.Net.Quic.Implementations.QuicImplementationProvider' from assembly 'System.Net.Quic, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
at identity.autofarmer.net!+0x8c7f79
at identity.autofarmer.net!+0x9465d5
at identity.autofarmer.net!+0x52f4ca
at identity.autofarmer.net!+0x2af272
at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.<>c__DisplayClass0_0.b__0(IWebHostBuilder) + 0x14
at identity.autofarmer.net!+0x729e1a
at identity.autofarmer.net!+0x2b0a33
at identity.autofarmer.net!+0x2b0685
at Program.
.NET Version
6.0.302
Anything else?
ASP.NET Core version: 6.0
VS2022
.NET SDK (reflecting any global.json):
Version: 6.0.302
Commit: c857713418
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.302\
global.json file:
Not found
Host:
Version: 6.0.7
Architecture: x64
Commit: 0ec02c8
.NET SDKs installed:
6.0.301 [C:\Program Files\dotnet\sdk]
6.0.302 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Activity
adityamandaleeka commentedon Aug 22, 2022
@Jaafar-abusair Can you clarify what you mean by "native mode" and "building natively"?
Jaafar-abusair commentedon Aug 22, 2022
@adityamandaleeka sorry for ambiguity, I mean using ILCompiler
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-preview.4.22229.4" />adityamandaleeka commentedon Aug 22, 2022
I see, thanks. I'll transfer this over to the runtime repo since it's not ASP.NET Core related.
AaronRobinsonMSFT commentedon Aug 22, 2022
@vitek-karas @MichalStrehovsky could this be a trimmer being overly aggressive?
AaronRobinsonMSFT commentedon Aug 22, 2022
Someone was nice enough to point out the 6.0 vs 7.0 issue. Apologies.
@Jaafar-abusair Can you pass the
/blflag to the command line build and share the binlog? This could be a compiler issue, but I'd like to also ensure we are passing the correct references to the tools too.adityamandaleeka commentedon Aug 22, 2022
Some added context:
QuicImplementationProviderwas actually removed in 7: #70421MichalStrehovsky commentedon Aug 22, 2022
There was a breaking change in Quic that deleted a type. Quic is not usable for things that target 6.0 but build with 7.0 Quic implementation. The ILCompiler package brings a 7.0 implementation with it.
AaronRobinsonMSFT commentedon Aug 22, 2022
@MichalStrehovsky Are there more details on this?
MichalStrehovsky commentedon Aug 22, 2022
This applies to the unsupported way of consuming NativeAOT where instead of targeting .NET 7.0 and setting PublishAot to true, one targets 6.0 and references the 7.0 ILCompiler package directly. The 7.0 package contains 7.0 CoreLib and that needs a matching 7.0 BCL.
AaronRobinsonMSFT commentedon Aug 22, 2022
@Jaafar-abusair Does the response from @MichalStrehovsky make sense? It seems you are constructing an unsupported scenario.
jkotas commentedon Aug 23, 2022
ASP.NET Core 6.0 has a dependency on experimental System.Net.Quic APIs. These APIs have changed in .NET 7. It is why mixing ASP.NET Core 6.0 and .NET 7 runtime that comes with the ILCompiler package does not work.
MichalStrehovsky commentedon Aug 24, 2022
This will not be an issue in .NET 7 and there's nothing we can do for when targeting .NET 6.
Jaafar-abusair commentedon Aug 24, 2022
Thank you guys