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

ManagedError: EndOfStringNotFound when starting Blazor in BlazorWebAssembly application with AoT #59628

Open
1 task done
Kizuto3 opened this issue Dec 24, 2024 · 0 comments
Open
1 task done
Labels
area-blazor Includes: Blazor, Razor Components NativeAOT

Comments

@Kizuto3
Copy link

Kizuto3 commented Dec 24, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I encountered an issue with Blazor wasm where non-primitive (class and struct) arguments passed through JSInterop are failing to be parsed with EndOfStringNotFound exception for both cases where arguments are passed from dotnet to JS and from JS to dotnet. However, this issue appears to be environment dependent, as it's only reproduceable on our machines in France and only with AoT compilation enabled. Without AoT compilation no issue is present.

Expected Behavior

Arguments should be passed successfully between JS and dotnet.

Steps To Reproduce

Example project: https://github.com/Kizuto3/Blazor-JavaScript-Interop

Steps:

  1. Make sure wasm tools are installed via running "dotnet workload install wasm-tools-net8".

  2. Publish the project to a desired folder.

  3. Host the project via IIS Manager. Here's my settings example:
    Image

  4. Open the hosted website in the browser and observe console via F12. I believe this issue depends on the environment, so it might work as expected on your machine. If everything is fine you should see a console log like "guid - string" appear in the console when mouse cursor leaves the website. If not, you should see an exception similar to the one in the Exceptions section below.

Exceptions (if any)

When passing arguments from dotnet to JS:
Image
I believe there is some code in Blazor.Start() JS method that invokes JSInterop and passes arguments from dotnet to JS.

When passing arguments from JS to dotnet:
Image
In this case there are 2 arguments: Guid and string, that are being passed from JS to dotnet.

.NET Version

8.0.11

Anything else?

Environment:
Image

ASP.NET Core shared framework version 8.0.11
Microsoft .NET Windows Server Hosting version 8.0.11

Publishing the project without AoT seem to fix the issue, so the root of this issue might be related to AoT compilation.
Please let me know if you need any more information.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components NativeAOT
Projects
None yet
Development

No branches or pull requests

1 participant