-
Notifications
You must be signed in to change notification settings - Fork 180
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
Comments
I figured out what's causing the WASM project build to fail. |
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. |
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. May you also provide a sample/stripped-down application? This will help us validate the fix. Best regards, |
@Pete-Nago also are the
|
I got it working now -- and I may have found the cause. |
I'm pretty sure I'm on non-preview, unless it doesn't state it in the Help > About info. |
Azure static web apps(Blazor, Github) Microsoft Visual Studio Community 2022 (64 ビット) I implemented it in the above environment, but the same error has occurred.
|
Encountered a similar issue while trying to publish a WASM project. The same error, not on a preview version of VS2022. |
@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. |
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. |
Hi, have absolutely same problem while deploying my app |
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? |
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 |
Sounds good 😃 I'll keep the issue open for a bit longer in case others have a different issue. |
In my case was the problem in referenced project, which contained win32 dll. Now it works fine. |
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'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.
Seems that it really does only fail on when using Oryx. |
@william-msft I have created a reproduction here https://github.com/Niphyr/oryx-test This is a new solution, with 2 stand-alone projects;
I configured a new Azure Static Web App (accessible here) which created the default deployment action. The first deployment was successful.
|
You can work around this issue by deploying locally with 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:
|
@william-msft Can we get this reopened since we have a reproducible case now? |
Hi Team, apologies for issue. Thank you for the additional context! Please give us sometime to look over this. |
@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? |
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.
|
@maraf can you take a look |
The problem is with dependecy on |
@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> |
@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 |
For me this started after I installed the |
.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. |
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:
The text was updated successfully, but these errors were encountered: