Skip to content

[Bug] Microsoft.Identity.Client.NativeInterop Incompatibility with Native AOT compilation #5226

@HotCakeX

Description

@HotCakeX

Library version used

0.18.1 for Nativeinterop and 4.70.1 for identity client package

.NET version

.NET 9

Scenario

PublicClient - desktop app

Is this a new or an existing app?

The app is in production, and I have upgraded to a new version of MSAL

Issue description and reproduction steps

I get an error when i compile my Native AOT app that uses the following packages:

  • Microsoft.Identity.Client
  • Microsoft.Identity.Client.Broker
  • Microsoft.IdentityModel.Abstractions
  • Microsoft.Identity.Client.NativeInterop

I always use the latest version of all of them.

IL3000 error:

Microsoft.Identity.Client.NativeInterop.Platform.GetExecutingAssemblyDirectory(): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.


This doesn't fix it either (already tried)

 <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>

Relevant code snippets

Expected behavior

I expect it to work and compile successfully for Native AOT.

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions