Skip to content

Native building project with Microsoft Identity included, failing on System.Net.Quic #74380

Closed

Description

@Jaafar-abusair

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.

image

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.

$(String[]) + 0x2b

.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

  1. adityamandaleeka commented on Aug 22, 2022

    @adityamandaleeka
    Member

    @Jaafar-abusair Can you clarify what you mean by "native mode" and "building natively"?

  2. Jaafar-abusair commented on Aug 22, 2022

    @Jaafar-abusair
    Author

    @adityamandaleeka sorry for ambiguity, I mean using ILCompiler
    <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="7.0.0-preview.4.22229.4" />

  3. adityamandaleeka commented on Aug 22, 2022

    @adityamandaleeka
    Member

    I see, thanks. I'll transfer this over to the runtime repo since it's not ASP.NET Core related.

  4. ghost added
    untriaged
    on Aug 22, 2022
  5. added and removed
    untriaged
    on Aug 22, 2022
  6. added
    untriaged
    on Aug 22, 2022
  7. AaronRobinsonMSFT commented on Aug 22, 2022

    @AaronRobinsonMSFT
    Member

    @vitek-karas @MichalStrehovsky could this be a trimmer being overly aggressive?

  8. AaronRobinsonMSFT commented on Aug 22, 2022

    @AaronRobinsonMSFT
    Member

    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

    Someone was nice enough to point out the 6.0 vs 7.0 issue. Apologies.

    @Jaafar-abusair Can you pass the /bl flag 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.

  9. adityamandaleeka commented on Aug 22, 2022

    @adityamandaleeka
    Member

    Some added context: QuicImplementationProvider was actually removed in 7: #70421

  10. MichalStrehovsky commented on Aug 22, 2022

    @MichalStrehovsky
    Member

    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.

  11. AaronRobinsonMSFT commented on Aug 22, 2022

    @AaronRobinsonMSFT
    Member

    The ILCompiler package brings a 7.0 implementation with it.

    @MichalStrehovsky Are there more details on this?

  12. MichalStrehovsky commented on Aug 22, 2022

    @MichalStrehovsky
    Member

    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.

  13. AaronRobinsonMSFT commented on Aug 22, 2022

    @AaronRobinsonMSFT
    Member

    @Jaafar-abusair Does the response from @MichalStrehovsky make sense? It seems you are constructing an unsupported scenario.

  14. added
    question
    and removed
    untriaged
    on Aug 22, 2022
  15. jkotas commented on Aug 23, 2022

    @jkotas
    Member

    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.

  16. MichalStrehovsky commented on Aug 24, 2022

    @MichalStrehovsky
    Member

    This will not be an issue in .NET 7 and there's nothing we can do for when targeting .NET 6.

  17. Jaafar-abusair commented on Aug 24, 2022

    @Jaafar-abusair
    Author

    Thank you guys

  18. ghost locked as resolved and limited conversation to collaborators on Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-NativeAOT-coreclrquestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions