microsoft-authentication-library-for-dotnet icon indicating copy to clipboard operation
microsoft-authentication-library-for-dotnet copied to clipboard

[Bug] some net6.0-windows dependencies are built with optimizations disabled

Open ghelyar opened this issue 1 year ago • 2 comments

Library version used

4.58.1

.NET version

.net6.0

Scenario

Other - please specify

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 updated Microsoft.Data.SqlClient from 5.1.2 to 5.1.4 and it updated its dependency on Microsoft.Identity.Client from 4.47.2 to 4.56.0, which added additional dependencies for net6.0-windows (Microsoft.Identity.Client.NativeInterop and Microsoft.Web.WebView2).

Both of these have DisableOptimizations set in their DebuggableAttribute.

This also occurs on the versions used by Microsoft.Identity.Client version 4.58.1 (current latest version)

Is this intentional?

I have a check in my CI pipeline to stop debug assemblies from being used. I can exclude these if it's intentional, but just wanted to check if it was intentional or accidental.

Relevant code snippets

No response

Expected behavior

No response

Identity provider

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

Regression

No response

Solution and workarounds

No response

ghelyar avatar Jan 11 '24 15:01 ghelyar

@gladjohn Do you know?

neha-bhargava avatar Jan 11 '24 23:01 neha-bhargava

@SimonCropp - what's the impact of this bug? @ashok672 - there is a good discussion on this in the PR from Simon, which however doesn't fix the issue. Summary is:

Microsoft.Identity.Client.NativeInterop is still

[assembly: Debuggable(
DebuggableAttribute.DebuggingModes.Default |
DebuggableAttribute.DebuggingModes.DisableOptimizations |
DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints |
DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]

This enumeration is primarily used by language developers. It is generally not used in application development. Development environments use [DebuggableAttribute.DebuggingModes](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggableattribute.debuggingmodes?view=net-8.0) based on compiler parameters such as /debug and /optimize.

So I guess that when we build the interop (it's a non-standard build), we don't add the correct flag.

bgavrilMS avatar Jan 23 '24 16:01 bgavrilMS