Blazored / Modal

A powerful and customizable modal implementation for Blazor applications.
https://blazored.github.io/Modal/
MIT License
786 stars 186 forks source link

[Bug] Error on browser console when publishing using dotnet 8 #564

Closed hagaygo closed 8 months ago

hagaygo commented 8 months ago

Everything worked fine on dotnet 6/7.

When trying to upgrade to dotnet 8 my app works fine on debug/release (WASM).

When publishing the app using dotnet publish i get the following error on browser console :

Error: AggregateException_ctor_DefaultMessage (Could not load type of field 'Blazored.Modal.Services.ModalService:OnModalInstanceAdded' (0) due to: Could not resolve type with token 01000031 from typeref (expected class 'System.Action`1' in assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51') assembly:netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 type:System.Action`1 member:(null))

Any idea how to fix it ?

Thanks in advance.

chrissainty commented 8 months ago

Can you provide a repro showing the issue please.

hagaygo commented 8 months ago

I'll try to create a simple repro.

hagaygo commented 8 months ago

After failing to reproduce the issue on a clean new project i went on "stripping" my project from non relevant and non public code.

Just before pushing the git to a github, i did some cleanup on the folder and tested again and the error did not show and the app worked.

Did the same cleaning on my original project and the app worked. It seems removing the "obj" folder from file system fixed the issue !!!.

Just to make it clear i did "clean" and "rebuild" via visual studio , that did not work , only totally removing the folder from file system fixed the issue.

I hope this helps any else in the future.