Skip to content
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

BlazorWASM-SWA: BadImageFormatException: This PE image is not a managed executable #1187

Closed
Pete-Nago opened this issue Dec 15, 2021 · 32 comments

Comments

@Pete-Nago
Copy link

Bug Report

  • At what date and time did you most recently experience the problem?
    Dec.15, 1pm (GMT+8)

  • Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use.
    Azure Static Web App - building via Github Actions

  • If your repo is publicly available please share its URL:
    not public

  • What happened?
    Oryx fails to build Blazor WASM proj.
    Local build succeeds via Visual Studio 2022.

  • What did you expect or want to happen?
    Oryx build should succeed.

  • How can we reproduce it?
    not sure how because repo is private

  • Do you have log output? Please include between the backticks:

  Determining projects to restore...
  All projects are up-to-date for restore.
  Tools6 -> /github/workspace/Tools6/bin/Release/net6.0/Tools6.dll
  Shared -> /github/workspace/Shared/bin/Release/net6.0/Shared.dll
  Client -> /github/workspace/Client/bin/Release/net6.0/Client.dll
  Client (Blazor output) -> /github/workspace/Client/bin/Release/net6.0/wwwroot
  Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Tools6 -> /github/workspace/Tools6/bin/Release/net6.0/Tools6.dll
  Shared -> /github/workspace/Shared/bin/Release/net6.0/Shared.dll
  Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018: The "PInvokeTableGenerator" task failed unexpectedly. [/github/workspace/Client/Client.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018: System.BadImageFormatException: This PE image is not a managed executable. [/github/workspace/Client/Client.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018:    at System.Reflection.MetadataLoadContext.LoadFromStreamCore(Stream peStream) [/github/workspace/Client/Client.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018:    at System.Reflection.MetadataLoadContext.LoadFromAssemblyPath(String assemblyPath) [/github/workspace/Client/Client.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018:    at PInvokeTableGenerator.GenPInvokeTable(String[] pinvokeModules, String[] assemblies) [/github/workspace/Client/Client.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018:    at PInvokeTableGenerator.Execute() [/github/workspace/Client/Client.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/github/workspace/Client/Client.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/github/workspace/Client/Client.csproj]
@Pete-Nago
Copy link
Author

I figured out what's causing the WASM project build to fail.
It fails when I add a project reference to a .Net6 class library proj.
Is this intended behavior?

@konvay
Copy link

konvay commented Jan 2, 2022

I can confirm the issue was due to a .NET 6 project reference in my case as well. Removing the reference and including all of the classes and necessary NuGet packages worked fine.

This doesn't feel like intended behavior, hopefully this gets prioritized.

@william-msft
Copy link
Contributor

Hi @Pete-Nago @konvay, would you happen to have a full log output? This will give us more clues into if this could be related to x86/x64 bit differences or DotNet runtime issue.
https://stackoverflow.com/questions/8996653/troubleshooting-badimageformatexception
dotnet/runtime#43791

May you also provide a sample/stripped-down application? This will help us validate the fix.

Best regards,

@william-msft
Copy link
Contributor

@Pete-Nago also are the .dlls listed in the logs provided in your project?

All projects are up-to-date for restore. Tools6 -> /github/workspace/Tools6/bin/Release/net6.0/Tools6.dll Shared -> /github/workspace/Shared/bin/Release/net6.0/Shared.dll Client -> /github/workspace/Client/bin/Release/net6.0/Client.dll

@Pete-Nago
Copy link
Author

I got it working now -- and I may have found the cause.
Build only fails when creating a project from the Blazor WASM template of VS 2022 Preview.
Build succeeds when generating the project from VS 2022 (non-preview) Blazor WASM template.
-- this succeeds even when referencing a .Net 6 class library project
Thus switching to the non-preview VS 2022 solved my issue.

@konvay
Copy link

konvay commented Jan 6, 2022

I got it working now -- and I may have found the cause. Build only fails when creating a project from the Blazor WASM template of VS 2022 Preview. Build succeeds when generating the project from VS 2022 (non-preview) Blazor WASM template.

I'm pretty sure I'm on non-preview, unless it doesn't state it in the Help > About info.
My build is failing in GitHub Actions, outside of Visual Studio.

@ghost
Copy link

ghost commented Jan 11, 2022

Azure static web apps(Blazor, Github)

Microsoft Visual Studio Community 2022 (64 ビット)
Version 17.0.4
.Net 6
Blazor => referencing a .Net 6 class library project

I implemented it in the above environment, but the same error has occurred.

/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018: The "PInvokeTableGenerator" task failed unexpectedly. [/github/workspace/BlazorMonitor/BlazorMonitor.csproj]
/opt/dotnet/6.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/6.0.1/Sdk/WasmApp.Native.targets(240,5): error MSB4018: System.BadImageFormatException: This PE image is not a managed executable. [/github/workspace/BlazorMonitor/BlazorMonitor.csproj]

@murali1
Copy link

murali1 commented Jan 24, 2022

Encountered a similar issue while trying to publish a WASM project. The same error, not on a preview version of VS2022.
Any ideas on how fix it?

@konvay
Copy link

konvay commented Jan 25, 2022

@murali1 Unfortunately the only solution we have is to avoid using Project References and move all of the classes you need directly into the WASM project.

e.g., I have a Models project that I use for both my .NET 6 API and my .NET 6 Blazor WASM app. Instead of being able to include the Models project as a dependency of my WASM project, I have to create duplicate classes. That way when the app deserializes the response payload, it has the same properties.

@calloncampbell
Copy link

I have two projects (.NET 6 Blazor WebAssembly) that were developed in Visual Studio 2022 and use a shared library (.NET 6) and one deploys to Azure Static Web Apps just fine by GitHub Actions and the other doesn't.

@CeSiumUA
Copy link

Hi, have absolutely same problem while deploying my app
I've removed all references to other projects (only packages left)
Is there any solution?

@william-msft
Copy link
Contributor

Hi Team, we are sorry to hear this issue is happening. Would someone be able to share a sample application so the Oryx team can investigate further?

@william-msft william-msft reopened this May 31, 2022
@CeSiumUA
Copy link

CeSiumUA commented Jun 1, 2022

Well, I've tried to reproduce it by creating the minimal project to reproduce that issue. I've copied all dependencies from my main project, and noticed, that I have EntityFramework and CosmosDB packages there, and they are braking Azure deploy. So, I've just removed that packages (they were not really needed, I just forgot to remove them some time ago), and it deployed successfully
Thank you :)

@william-msft
Copy link
Contributor

Sounds good 😃 I'll keep the issue open for a bit longer in case others have a different issue.

@RichardHorky
Copy link

In my case was the problem in referenced project, which contained win32 dll. Now it works fine.

@y2kbugger
Copy link

Well, I've tried to reproduce it by creating the minimal project to reproduce that issue. I've copied all dependencies from my main project, and noticed, that I have EntityFramework and CosmosDB packages there, and they are braking Azure deploy. So, I've just removed that packages (they were not really needed, I just forgot to remove them some time ago), and it deployed successfully Thank you :)

@william-msft

But what if you do want CosmosDB? Local build to WASM works fine, could be a windows vs linux thing. Echoing Konvay, This doesn't feel like intended behavior. I've had it creep up twice now.

I can confirm the issue was due to a .NET 6 project reference in my case as well. Removing the reference and including all of the classes and necessary NuGet packages worked fine.

This doesn't feel like intended behavior, hopefully this gets prioritized.

@y2kbugger
Copy link

y2kbugger commented Jan 2, 2023

I've just tested on linux to eliminate OS as a possible causal variable, but the following completes without error on both windows and linux with the exact same version of MSBuild.

$ dotnet publish -c Release ./NutritionFlockDataGui.csproj 
MSBuild version 17.4.0+18d5aef85 for .NET
...

Seems that it really does only fail on when using Oryx.
I can't quite follow where in Oryx defines the actual build parameters , or where dotnet publish is called. Maybe some options are being passed that could be used to reproduce this locally.

@y2kbugger
Copy link

@radical, @lewing, in case this is really an edge case for the PInvokeTableGenerator

@Niphyr
Copy link

Niphyr commented Jan 3, 2023

@william-msft I have created a reproduction here https://github.com/Niphyr/oryx-test

This is a new solution, with 2 stand-alone projects;

  1. Microsoft.NET.Sdk.BlazorWebAssembly
  2. Microsoft.NET.Sdk

I configured a new Azure Static Web App (accessible here) which created the default deployment action.

The first deployment was successful.
The second deployment was after adding a project reference to the class library from the wasm project.(Niphyr/oryx-test@3dc24cb) - also successful
The third deployment was after adding the Microsoft.Azure.Cosmos reference to the class library, which failed with the error people are experiencing (https://github.com/Niphyr/oryx-test/actions/runs/3827527925).

"2023-01-03 07:07:51"|ERROR|MSBuild version 17.4.0+18d5aef85 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  OryxTest.TestLibrary -> /github/workspace/OryxTest.TestLibrary/bin/Release/net7.0/OryxTest.TestLibrary.dll
  OryxTest.BlazorWasm -> /github/workspace/OryxTest.BlazorWasm/bin/Release/net7.0/OryxTest.BlazorWasm.dll
  OryxTest.BlazorWasm (Blazor output) -> /github/workspace/OryxTest.BlazorWasm/bin/Release/net7.0/wwwroot
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.
  OryxTest.TestLibrary -> /github/workspace/OryxTest.TestLibrary/bin/Release/net7.0/OryxTest.TestLibrary.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018: The "ManagedToNativeGenerator" task failed unexpectedly. [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018: System.BadImageFormatException: This PE image is not a managed executable. [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018:    at System.Reflection.MetadataLoadContext.LoadFromStreamCore(Stream peStream) [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018:    at System.Reflection.MetadataLoadContext.LoadFromAssemblyPath(String assemblyPath) [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018:    at PInvokeTableGenerator.Generate(String[] pinvokeModules, String[] assemblies, String outputPath) [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018:    at ManagedToNativeGenerator.ExecuteInternal() [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018:    at ManagedToNativeGenerator.Execute() [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/opt/dotnet/7.0.100/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.1/Sdk/WasmApp.Native.targets(292,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/github/workspace/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj] | 1 | Please build your app locally before publishing. | https://docs.microsoft.com/en-us/azure/app-service/configure-language-dotnetcore?pivots=platform-linux```

@y2kbugger
Copy link

You can work around this issue by deploying locally with swa deploy docs

I did have to point at the build outputs of both api and frontend rather than just the sourcecode of api that the docs specify.

My swa-cli.config.json ends up looking like this:

{
  "$schema": "[https://aka.ms/azure/static-web-apps-cli/schema"](https://aka.ms/azure/static-web-apps-cli/schema%22),
  "configurations": {
    "analytics-data-webapp": {
      "appLocation": "frontend-blazorwasm",
      "apiLocation": "backend-functionapp",
      "appBuildCommand": "dotnet publish -c Release -o bin/apprelease",
      "apiBuildCommand": "dotnet publish -c Release",
      "run": "dotnet watch run",
      "open": true,
      "appDevserverUrl": "http://localhost:5000",
      "appName": "XxXxxxxxXxxxx",
      "resourceGroup": "rg-xxxxxx-xx-eastus01",
      "deploy": {
        "apiLocation": "backend-functionapp/bin/Release/net7.0",
        "outputLocation": "bin/apprelease/wwwroot"
      }
    }
  }
}

swa start to run locally and swa build && swa deploy --env Production -Vsilly to deploy

@y2kbugger
Copy link

@william-msft Can we get this reopened since we have a reproducible case now?

@william-msft
Copy link
Contributor

Hi Team, apologies for issue. Thank you for the additional context! Please give us sometime to look over this.

@william-msft william-msft reopened this Jan 18, 2023
@waliMSFT
Copy link
Contributor

@Niphyr I tested your app in our side. It was built successfully and I did not find any issue. Could you please try again with our latest image?

@sean-waldo
Copy link

PEeRROR

Hi Team, I use VS 2022 non-preview with the option to consume preview features by default, and I ran into this error trying publish blazor wasm project to folder. Any solution, please?

@pauld-msft
Copy link
Member

Hello @sean-waldo, thanks for your comment. I was just able to reproduce this locally with Oryx's latest github actions images using the sample app that @Niphyr shared. Creating a work item on our end to handle the investigation.

$ docker run -it --rm -v C:/Users/pauldorsch/source/repos/oryx-test:/app mcr.microsoft.com/oryx/build:github-actions-debian-bullseye-20230317.1 //bin/bash
root@372644913fee:/# oryx build /app
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20230317.1, Commit: 2baf5f02a27e9045bc752b7c15a55b609b53ae82, ReleaseTagName: 20230317.1

Build Operation ID: db30d5a82dd6e3c2
Repository Commit : bbe05b83e3bc6bdde36fe04f996bd86fd500fe45
OS Type           : bullseye
Image Type        : githubactions

Detecting platforms...
Detected following platforms:
  dotnet: 7.0.4
Version '7.0.4' of platform 'dotnet' is not installed. Generating script to install it...
Detected the following frameworks: blazor

.
.
.

Successfully installed workload(s) wasm-tools.

  Determining projects to restore...
  Restored /app/OryxTest.TestLibrary/OryxTest.TestLibrary.csproj (in 5.72 sec).
  Restored /app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj (in 5.93 sec).
Publishing...
"2023-03-21 13:26:34"|ERROR|MSBuild version 17.5.0+6f08c67f3 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  OryxTest.TestLibrary -> /app/OryxTest.TestLibrary/bin/Release/net7.0/OryxTest.TestLibrary.dll
  OryxTest.BlazorWasm -> /app/OryxTest.BlazorWasm/bin/Release/net7.0/OryxTest.BlazorWasm.dll
  OryxTest.BlazorWasm (Blazor output) -> /app/OryxTest.BlazorWasm/bin/Release/net7.0/wwwroot
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  OryxTest.TestLibrary -> /app/OryxTest.TestLibrary/bin/Release/net7.0/OryxTest.TestLibrary.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018: The "ManagedToNativeGenerator" task failed unexpectedly. [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018: System.BadImageFormatException: This PE image is not a managed executable. [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018:    at System.Reflection.MetadataLoadContext.LoadFromStreamCore(Stream peStream) [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018:    at System.Reflection.MetadataLoadContext.LoadFromAssemblyPath(String assemblyPath) [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018:    at PInvokeTableGenerator.Generate(String[] pinvokeModules, String[] assemblies, String outputPath) [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018:    at ManagedToNativeGenerator.ExecuteInternal() [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018:    at ManagedToNativeGenerator.Execute() [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj]
/tmp/oryx/platforms/dotnet/7.0.202/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.4/Sdk/WasmApp.Native.targets(290,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/app/OryxTest.BlazorWasm/OryxTest.BlazorWasm.csproj] | 1 | Please build your app locally before publishing. | https://docs.microsoft.com/en-us/azure/app-service/configure-language-dotnetcore?pivots=platform-linux

@lewing
Copy link
Member

lewing commented Mar 22, 2023

@maraf can you take a look

@maraf
Copy link
Member

maraf commented Mar 23, 2023

The problem is with dependecy on Microsoft.Azure.Cosmos which brings into compilation some native assemblies and we don't filter these out when looking to pinvokes in managed assemblies. I'll file an issue in the dotnet runtime repository.

@maraf
Copy link
Member

maraf commented Mar 27, 2023

@pauld-msft The problem is already fixed for .NET 8, for .NET 7 a backport is pending for next servicing release dotnet/runtime#83957.

In the meantime the issue could be bypassed with a bit of msbuild

<Target Name="SkipUnmanagedDlls" BeforeTargets="_GenerateManagedToNative">
  <ItemGroup>
    <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" 
      Condition="'%(_WasmAssembliesInternal.FileName)' == 'Cosmos.CRTCompat' or OTHER NATIVE DLLs" />
  </ItemGroup>
</Target>

@pauld-msft
Copy link
Member

@maraf thanks for sharing the issue link here, and the workaround! We adopt new .NET versions shortly after they are released, so this will eventually be adopted by Oryx. Since this is the case and it is pending the adoption of the new .NET 7 binaries, I will go ahead and close the associated work item on our side to investigate. Really appreciate it

seesharprun added a commit to seesharprun/blazor-wasm-codespaces-demo that referenced this issue Apr 13, 2023
@sean-waldo
Copy link

sean-waldo commented May 6, 2023

My solution was removal of references to Microsoft.ML.OnnxRuntime.Managed in the Server project and the error was no more. (VS 2022, .NET Core 6). I think the problem is a dependency thing, dependencies onmanaged code.
GHUB

@MetaFight
Copy link

MetaFight commented Jul 6, 2023

For me this started after I installed the wasm-tools-net6 dotnet workload. Uninstalling it resolved my issue:
dotnet workload uninstall wasm-tools-net6

@simonjj
Copy link

simonjj commented Jan 11, 2024

.NET 7 and .NET 8 have fixes backport for .NET 6 should be available as well. Closing issue as fixed now. Please reopen if it continues to exist.

@simonjj simonjj closed this as completed Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests