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

Static assets not being linked in Blazor Wasm 3.1.0-preview4 #17596

Closed
marcusturewicz opened this issue Dec 4, 2019 · 3 comments
Closed

Static assets not being linked in Blazor Wasm 3.1.0-preview4 #17596

marcusturewicz opened this issue Dec 4, 2019 · 3 comments

Comments

@marcusturewicz
Copy link

marcusturewicz commented Dec 4, 2019

Describe the bug

I have a Blazor WebAssembly project currently running on .NET Core 3.1.0-preview3. The project has a main blazorwasm project and a razor class library project with javascript assets and C# wrapper classes. I just tried to update it to 3.1.0-preview4 and the javascript files are no longer being linked to the index.html page. Has something changed with static files for razor class libraries that I have missed? These are the changes I made to update it.

To Reproduce

  1. Have .NET Core 3.1.0 SDK installed.
  2. Clone https://github.com/marcusturewicz/jsonvalidate.net and checkout the netcore3.1 branch.
  3. Run ./watch-run.sh or ./watch-run.ps1
  4. Go to http://localhost:5000
  5. Notice the text area is not rendered correctly as per the live site. Open inspector console and see the following error:
Uncaught (in promise) TypeError: Request failed
blazor.webassembly.js:1 WASM: Unhandled exception rendering component:
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM: Microsoft.JSInterop.JSException: Could not find 'codemirror' in 'window'.
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM: Error: Could not find 'codemirror' in 'window'.
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at http://localhost:5000/_framework/blazor.webassembly.js:1:8937
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at Array.forEach (<anonymous>)
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at p (http://localhost:5000/_framework/blazor.webassembly.js:1:8898)
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at Object.invokeJSFromDotNet (http://localhost:5000/_framework/blazor.webassembly.js:1:9470)
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at _mono_wasm_invoke_js_marshalled (http://localhost:5000/_framework/wasm/mono.js:1:165750)
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at wasm-function[6221]:0x11936a
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at wasm-function[1431]:0x402ee
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at wasm-function[636]:0x147cf
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at wasm-function[4996]:0xeb135
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:     at wasm-function[3247]:0xa0666
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Mono.WebAssembly.Interop.MonoWebAssemblyJSRuntime.InvokeJS (System.String identifier, System.String argsJson) <0x1df64c8 + 0x00044> in <d1b91dfced854ee99a396ef9a5cfcf72>:0 
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Microsoft.JSInterop.JSInProcessRuntime.Invoke[TValue] (System.String identifier, System.Object[] args) <0x1b9ff50 + 0x0001c> in <3eedf0ca90ca4e72bf6870618ca98c7c>:0 
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at JsonValidate.JSInterop.CodeMirror.Create (Microsoft.JSInterop.IJSRuntime jsRuntime, System.Object textArea) <0x1f3e418 + 0x00024> in <fb0fad5e6d0f4989beab7611600e0c8f>:0 
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at JsonValidate.Shared.JsonValidator.OnAfterRender (System.Boolean firstRender) <0x1f3e340 + 0x0002a> in <9be0515d869e4770b96117fe7a197f0d>:0 
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleAfterRender.OnAfterRenderAsync () <0x1f3def0 + 0x00028> in <cbf249d7f04d4fa18d15bfae8ef7f389>:0 
h.printErr @ blazor.webassembly.js:1
blazor.webassembly.js:1 WASM:   at Microsoft.AspNetCore.Components.Rendering.ComponentState.NotifyRenderCompletedAsync () <0x1f3dc50 + 0x0001c> in <cbf249d7f04d4fa18d15bfae8ef7f389>:0 

Further technical details

  • dotnet --info:
.NET Core SDK (reflecting any global.json):
 Version:   3.1.100
 Commit:    cd82f021f4

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.100/

Host (useful for support):
  Version: 3.1.0
  Commit:  65f04fb6db

.NET Core SDKs installed:
  2.2.203 [/usr/local/share/dotnet/sdk]
  2.2.402 [/usr/local/share/dotnet/sdk]
  3.0.100-rc1-014190 [/usr/local/share/dotnet/sdk]
  3.0.100 [/usr/local/share/dotnet/sdk]
  3.1.100-preview1-014459 [/usr/local/share/dotnet/sdk]
  3.1.100-preview2-014569 [/usr/local/share/dotnet/sdk]
  3.1.100-preview3-014645 [/usr/local/share/dotnet/sdk]
  3.1.100 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-rc1.19457.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0-preview1.19508.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0-preview2.19528.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0-preview3.19555.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-rc1-19456-20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0-preview1.19506.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0-preview2.19525.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0-preview3.19553.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  • Running from terminal with ./watch-run.sh
@chrissainty
Copy link
Contributor

chrissainty commented Dec 4, 2019

You have to link the files manually as you do with Blazor Server. The automatic inclusion of CSS and JS files from Razor Class Libraries was always something that was temporary.

The team had mentioned before that it would be going away at some point, 3.1 is it I think.

@marcusturewicz
Copy link
Author

marcusturewicz commented Dec 4, 2019

Thanks @chrissainty, I think you're right. Looks like they need to be in wwwroot folder and linked rather than just placed in content folder as before. Seems to be working now with these changes.

@chrissainty
Copy link
Contributor

Glad to help :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants