question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Including a NativeFileReference causes a Blazor error in Release mode

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Create a default Blazor WebAssembly App project. Configure for HTTPS only.

This project runs successfully in both Debug and Release mode.

Now add a Folder Data and place in there the e_sqlite3.o file from Steve Sandersons demo.

Add to the Project file the line in Item Group

<NativeFileReference Include="Data\e_sqlite3.o" />

Now the project will run in Debug mode, but in Release mode it gets an error as follows:

blazor.webassembly.js:1 Assertion failed: Cannot call unknown function mono_wasm_set_is_debugger_attached, make sure it is exported

This means that we cannot use Hot Release (currently only runs in Release mode) with a native file.

Expected Behavior

Native Files should be useable in both Debug and Release mode.

Steps To Reproduce

Described above

Exceptions (if any)

blazor.webassembly.js:1 Assertion failed: Cannot call unknown function mono_wasm_set_is_debugger_attached, make sure it is exported

.NET Version

Net 6.0

Anything else?

.NET SDK (reflecting any global.json): Version: 6.0.101 Commit: ef49f6213a

Runtime Environment: OS Name: Windows OS Version: 10.0.19043 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.101\

Host (useful for support): Version: 6.0.1 Commit: 3a25a7f1cc

.NET SDKs installed: 3.1.406 [C:\Program Files\dotnet\sdk] 5.0.103 [C:\Program Files\dotnet\sdk] 5.0.202 [C:\Program Files\dotnet\sdk] 5.0.300 [C:\Program Files\dotnet\sdk] 5.0.301 [C:\Program Files\dotnet\sdk] 6.0.100 [C:\Program Files\dotnet\sdk] 6.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Microsoft Visual Studio Community 2022 (64-bit) Version 17.0.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:35 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
SteveSandersonMScommented, Mar 23, 2022

@Zhiyuan-Amos It looks like this is due to a change in the runtime. Would you mind filing an issue at https://github.com/dotnet/runtime, indicating clearly that this is related to WebAssembly?

@lewing Not sure if it’s intentional to remove the FS JS API. It would be good to discuss next week and make sure that, if we’re having a breaking change here, we have some way to communicate it and perhaps allow passing some Emscripten flags to restore the FS APIs if relevant.

1reaction
ericsinkcommented, Mar 2, 2022

(Pretty sure iOS will always need that special provider anyway, because it does the DllImport("__Internal") trick.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blazor error Could not find NativeFileReference
I am watching this Steve Sanderson's Video titled New Blazor WebAssembly capabilities in .NET 6. I Cloned the git hub repo and tried...
Read more >
Handle errors in ASP.NET Core Blazor apps
This article describes how Blazor manages unhandled exceptions and how to develop apps that detect and handle errors.
Read more >
ASP.NET Core updates in .NET 6 Release Candidate 2
You add native dependencies to your Blazor WebAssembly app by adding NativeFileReference items in your project file. When you build the project ...
Read more >
Errors when compiling in release mode of Visual Studio but ...
But when I switch to release mode and tried to build the app I got the following three errors which do not occur...
Read more >
ASP.NET Community Standup - Blazor WebAssembly on .NET 6
NET with free self-guided learning from Microsoft Learn: http://aka.ms/learndotnet # Blazor #WASM #WebAssembly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found