-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in .NET 8.0-preview.5: dependent assembly is not included in TPA list when running fxdependent pwsh build with preview.5 dotnet.exe #86713
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsDescriptionThis is root cause of the PowerShell issue Microsoft.Management.Infrastructure can't be loaded in latest .NET 8 Preview 5 build. My investigation shows it’s a regression in .NET 8-preview.5. The The startup tracing logs for using the preview.5 (p5-trace.txt) and preview.4 (p4-trace.txt) SDKs are attached. The traces were generated by setting I want to call out that the p5-trace.txt The .NET 8.0-preview.5 build I'm using is Reproduction StepsSee the repro steps in PowerShell/PowerShell#19679. Expected behaviorThe fxdependent pwsh build works as expected when using with the .NET 8.0-preview.5 build. Actual behaviorCrash at startup because the MMI.dll cannot be found -- it's not included in the TPA list. Regression?Yes. it's a regression from .NET 8.0-preview.4. Known WorkaroundsN/A Configuration
Win10-x64 platform Other informationNo response
|
@agocke - This is Preview 5 related and blocking our ability to ship PowerShell in the official Docker images for that release. |
@elinor-fung Could you take a look? Maybe related to the RID changes? |
It's very likely the RID changes (the package is 3 years old on NuGet, but it used on-portable RIDs back then). @daxian-dbw could you please try to modify the powershell Specifically add a runtime property |
@vitek-karas I tried it, but it results in the same crash. |
Can you try |
@elinor-fung Sure. I tried it again and this time it works, the crash is gone after adding |
Thanks @daxian-dbw. That is the fallback/compat switch we have for packages that currently use non-portable RIDs. The recommendation for packages is to more to portable RIDs - and if any assets are truly version/distro specific, handle custom loading logic through existing .NET APIs. We can work with powershell to transition |
It looks like @elinor-fung has offered a long-term plan to resolve this. But in the short term, we need to figure out what to do so we can ship the Preview 5 Docker images. @elinor-fung, is the use of this config property something that should be acceptable for shipping PowerShell in this configuration to customers in this Preview release? @daxian-dbw, are we able to get a new release of PowerShell in time for the .NET 8 Preview 5 release (June 13)? If not, would it be acceptable for us to modify the |
Yes, we should be able to use the config to unblock shipping the Docker images. |
@mthalman I don't think we will be able to have a new release before June 13. Feel free to make the necessary changes in your docker build to unblock the .NET 8 preview.5 release. @elinor-fung We own the Microsoft.Management.Infrastructure package but we don't own the corresponding code. It's legacy managed C++ code that only builds in Windows build. Loop in @adityapatwardhan who I believe did the packaging work for the 2.0 version. Can you please share some pointers for us to better understand what "portable" and "non-portable" RID means? |
Just want to call out on the impact -- applications that host PowerShell 7+ (i.e. using the 7.2+ version PowerShell NuGet packages) will run into the same crash when they update to .NET 8 due to this breaking change. PowerShell Azure Function is an example of those applications. |
The
By 'portable' RIDs, we mean the non-version-specific, non-distribution-specific RIDs (sorry, 'portable' is rather overloaded). Those RIDs are the ones we are referring to in the RID doc with:
In that same doc's list of examples for different systems, the 'portable' RIDs are the ones described as 'not version-specific' or 'not distribution-specific'. 'Non-portable' refers to all the other RIDs that are version-specific and/or distribution-specific. |
So in this case, would adding a |
Yeah, if those same assets were |
Unfortunately, the native DLLs in each of the RIDs are specific to the Windows OS version.
|
|
Actually, win7 and win81 are no longer supported in .NET 8 (dotnet/core#7556) -- you can just move the win10 DLL to the win-x64 TFM folder and everything should work. |
Note: this bug is blocking razor's ability to adopt .NET 8 Preview 5 as we use |
@daxian-dbw Where you able to make the changes I suggested? Note that this is an intentional breaking change, specified in https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list. |
We cannot make the changes because 1) we don't own the sources and can no longer build those assemblies 2) we cannot use the existing assemblies in that package to repackage due to compliance issue. In fact, that package itself has compliance issue and our team is currently looking into feasibility to remove dependency on it. @adityapatwardhan and @SeeminglyScience may have more details to share. |
You shouldn't need to rebuild any assemblies -- my suggestion is just to move the win10-x64 assembly to the |
We cannot repackage the existing assemblies without a build pipeline. It violates the compliance as far as I know. |
@daxian-dbw - At a minimum, you should be able to make the runtimeconfig change with the |
We can, for the PowerShell packages. @adityapatwardhan is working on the next preview release, so he can share more about the plan. However, for any application out there that host PowerShell by using the PowerShell NuGet packages (e.g. System.Management.Automation), they will need to explicitly add this runtime config too, otherwise, they will run into the same problem. |
Closing as this is not a bug in runtime -- the behavior is expected in .NET 8. |
Description
This is root cause of the PowerShell issue Microsoft.Management.Infrastructure can't be loaded in latest .NET 8 Preview 5 build.
My investigation shows it’s a regression in .NET 8-preview.5.
The
Microsoft.Management.Infrastructure.dll
(MMI.dll) can be loaded in preview.5 without a problem byAssembly.LoadFrom
. However, when running a fxdependent build of pwsh with the .NET 8.0-preview.5 SDK (through....\dotnet.exe ....\pwsh.dll
), the MMI.dll doesn’t get included in theTrusted_Platform_Assemblies
(TPA) list, and thus it cannot be found when the loading is requested. As a comparison, when running the same fxdependent build of pwsh with the .NET 8-preview.4 SDK, the MMI.dll is included in the TPA list and hence the loading works as expected at pwsh startup.The startup tracing logs for using the preview.5 (p5-trace.txt) and preview.4 (p4-trace.txt) SDKs are attached. The traces were generated by setting
COREHOST_TRACE = 1
. The build producedpwsh.deps.json
file for the fxdependent build is also attached for your reference.I want to call out that the
Microsoft.Management.Infrastructure
NuGet package shipsnetstandard1.6
managed assemblies (MMI.dll). Maybe the regression in .NET 8 preview.5 is related to thenetstandard1.6
TFM? Just a guess.p5-trace.txt
p4-trace.txt
pwsh.deps.json.txt
The .NET 8.0-preview.5 build I'm using is
8.0.100-preview.5.23269.4
.Reproduction Steps
See the repro steps in PowerShell/PowerShell#19679.
Also, the tracing logs should provide lots of information about the issue.
Expected behavior
The fxdependent pwsh build works as expected when using with the .NET 8.0-preview.5 build.
Actual behavior
Crash at startup because the MMI.dll cannot be found -- it's not included in the TPA list.
Regression?
Yes. it's a regression from .NET 8.0-preview.4.
Known Workarounds
N/A
Configuration
Win10-x64 platform
Other information
No response
The text was updated successfully, but these errors were encountered: