Skip to content

App after upgrade 5.1.2 -> 5.1.4 starts require .NET Desktop Runtime instead of .NET Runtime #2309

Closed as not planned

Description

@AlexanderKot

After upgrade some dependencies in our app (ASP NET MVC & console projects under .Net7) it suddenly starts require Desktop Runtime instead of console one which was enough previously.
Downgrading only SqlClient back to 5.1.2 helps it works again without Desktop runtime.
With our app it is reproducible with only changing 1 symbol 2->4 in csproj.

Unfortunately i do not manage to reproduce this with simple console app with only 1 despondency to SqlClient.
Any idea what it can be be?

Activity

  1. David-Engel commented on Jan 20, 2024

    @David-Engel
    Contributor

    I suspect it was the bump in the Azure.Identity dependency version in 5.1.4 to address the Azure.Identity vulnerability. Does the same thing result from only bumping to MDS 5.1.3? The only thing that changed from 5.1.3 to 5.1.4 was that dependency version. I don't think there will be anything we can do about it if Azure.Identity is bringing in the Desktop Runtime requirement.

  2. AlexanderKot commented on Jan 20, 2024

    @AlexanderKot
    Author

    Have tested with 5.1.3 - it is OK no Desktop needed.
    So you are right.
    It will be surprise for many projects, as it happens for us.

    In any case having such direct dependency in so low level lib looks not very good.
    Seems such services better manage with DI. Not all projects using MSSQL run in Azure.
    Just having this dependency cause loading additional 700K of dlls with unneeded functionality.

  3. kedia990 commented on Jan 21, 2024

    @kedia990

    This broke upgraded applications in our environment as well. We containerize ASP.NET Core workloads and run them with the dotnet/aspnet:8.0-nanoserver-ltsc2022 base layer; they work fine until MDS 5.1.3. When we upgrade to MDS 5.1.4, they fail to start up (failure log below). FWIW, we don't use Azure Identity services for these applications either.

    You must install or update .NET to run this application.
    
    App: C:\app\<Redacted>.dll
    Architecture: x64
    Framework: 'Microsoft.WindowsDesktop.App', version '8.0.0' (x64)
    .NET location: C:\Program Files\dotnet\
    
    No frameworks were found.
    
    Learn more:
    https://aka.ms/dotnet/app-launch-failed
    
    To install missing framework, download:
    https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=8.0.0&arch=x64&rid=win-x64&os=win10
    
  4. ErikEJ commented on Jan 22, 2024

    @ErikEJ
    Contributor

    @kedia990 What is the target framework of all your projects?

  5. AlexanderKot commented on Jan 22, 2024

    @AlexanderKot
    Author

    In our project net7.0-windows

  6. ErikEJ commented on Jan 22, 2024

    @ErikEJ
    Contributor

    @AlexanderKot That seems to be by design in Azure.Identity - why do you need net7.0-windows ??

  7. bdemolder commented on Jan 22, 2024

    @bdemolder

    We have noticed the same issue, in a pure ASP.Net Core API (REST), suddenly we need the Desktop Runtime. Will try 5.1.3 for now as well.

  8. AlexanderKot commented on Jan 22, 2024

    @AlexanderKot
    Author

    We use net7.0-windows because of
    300+ Warnings
    CA1416 This call site is reachable on all platforms. 'XXXX' is only supported on: 'windows'.
    And we are not ready to clean this out

  9. JRahnama commented on Jan 22, 2024

    @JRahnama
    Contributor

    @AlexanderKot this is by design when using WAM (Web Account Manager).
    When targeting net-windows WAM is included by default.

    For migration purposes, and if you have a .NET 6, .NET Core, or a .NET Standard application that needs to use both WAM and the embedded browser, you will also need to use the Microsoft.Identity.Client.Desktop package. Once added, developers can use WithWindowsDesktopFeatures when setting up their public client application.
    If your application targets UWP or net-windows (version-dependent Target Framework Moniker for Windows), WAM is included in the MSAL.NET package.

    Read more here.

    I would suggest using

    [SupportedOSPlatform("windows")]

    inside problematic classes/functions and convert the TFM net7.0

  10. AlexanderKot commented on Jan 22, 2024

    @AlexanderKot
    Author

    Thank you
    we can use many workarounds including proposed by you.
    But we are not unique with this problem, and before 5.1.4 it was no such dependency.

    Ideal solution could be removing direct dependency to Azure libs from DB access lib, and embed it using DI whenever it is really needed. Lets imagine that instead Azure we need AWS infrastructure ...
    I understood that chances that this will happens are minimal. :(

  11. JRahnama commented on Jan 22, 2024

    @JRahnama
    Contributor

    @AlexanderKot, I guess this is something new which was added to the latest release of Microsoft.Identity.Client. I can happily transfer the issue to that repository or you can open an issue with them. As SqlClient driver we do not have any control over that behavior.

  12. kedia990 commented on Jan 22, 2024

    @kedia990

    @ErikEJ we're targeting net8-windows in our affected projects. That's intentional and required: we depend on certain libraries that use Windows-specific APIs, and it's not something that we can trivially eliminate (and we therefore containerize such applications on Windows hosts with the dotnet/aspnet:8.0-nanoserver-ltsc2022 base layer). And to clarify (again), we do not require any Azure Identity services; the stuff we're doing is all on-premise.

    (Cross-referencing the related AzureAD/microsoft-authentication-library-for-dotnet#4468 for my easy reference / might be interesting to the rest of the audience here.)

  13. JRahnama commented on Jan 22, 2024

    @JRahnama
    Contributor

    Also to mention that we have this work item, but yet not decided about a date or its necessity/urgency.

  14. bdemolder commented on Jan 23, 2024

    @bdemolder

    What I can see is from the dependency graph (made it myself):
    image

    But the main problem is that Azure.Identity 1.7.0 is marked as Vulnerable as well...
    And if we manually set Azure.Identity to the last non-vulnerable one (1.10.2), it needs:
    Microsoft.Identity.Client (>= 4.54.1)

    Which by itself - I think - requires .Net Desktop Runtime like previously mentioned.

    So for most of us there is either a choice of using the MDS 5.1.3 with Azure.Identity (1.7.0) that is marked vulnerable,
    Or live with the fact that we need this extra runtime as well.
    While some of us don't even have anything to do with Azure.

  15. kf-gonzalez commented on Jan 23, 2024

    @kf-gonzalez

    Closing, related to #1108

  16. ErikEJ commented on Aug 2, 2024

    @ErikEJ
    Contributor

    For anyone faced with this, here is a fix: dotnet/efcore#34331 (comment)

  17. gfody commented on Aug 19, 2024

    @gfody

    For anyone faced with this, here is a fix: dotnet/efcore#34331 (comment)

    I encountered this rev'ing MDS from 5.1.2 to 5.2.1 and adding the package reference to Azure.Identity 1.12.0 didn't help, fwiw

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

    No labels
    No labels

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions