I have a formlayout error when running a Blazor website

半腔热情 提交于 2019-12-23 06:41:43

问题


I updated visual studio 19 and before that my site ran exactly how i intended it. Now i am getting an error when i load the home page but then breaks before it can finish loading it. I have provided the error code below. I also would let you know that i have seen this post ( How to turn on CircuitOptions.DetailedErrors? ) and tried it all but it hasn't worked.

Information: Normalizing '_blazor' to 
'http://fakesite.com/_blazor'.

Error: There was an unhandled exception on the current circuit, so this 
circuit will be terminated. For more details turn on detailed exceptions in 
'CircuitOptions.DetailedErrors'

Information: Connection disconnected.

new error after implementing Hanks solution

Error: Microsoft.JSInterop.JSException: Could not find 'FormLayout' in 'window.DxBlazor'.
Error: Could not find 'FormLayout' in 'window.DxBlazor'.
    at http://fakesite.com/_framework/blazor.server.js:8:27768
    at Array.forEach (<anonymous>)
    at d (http://fakesite.com/_framework/blazor.server.js:8:27729)
    at http://fakesite.com/_framework/blazor.server.js:8:28342
    at new Promise (<anonymous>)
    at e.beginInvokeJSFromDotNet (http://fakesite.com/_framework/blazor.server.js:8:28316)
    at http://fakesite.com/_framework/blazor.server.js:1:19148
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (http://fakesite.com/_framework/blazor.server.js:1:19119)
    at e.processIncomingData (http://fakesite.com/_framework/blazor.server.js:1:17165)
   at Microsoft.JSInterop.JSRuntimeBase.InvokeWithDefaultCancellation[T](String identifier, IEnumerable`1 args)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.GetErrorHandledTask(Task taskToHandle)

this is the CreateWebHostBuilder method

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
     WebHost.CreateDefaultBuilder(args)
     .UseSetting(WebHostDefaults.DetailedErrorsKey, "true")
     .CaptureStartupErrors(true)
     .UseStartup<Startup>();

回答1:


Start by taking the advice literally.

In Startup.ConfigureServices:

services.AddServerSideBlazor().AddCircuitOptions(options => { options.DetailedErrors = true; });

and then post the results here.




回答2:


It seems that this is issue is related to client scripts. If you see "window.DxBlazor" in the message, this means that you need to look for the cause in the client scripts. Please make sure that you have the latest up-to-date DevExpress scripts included in your project. See the 6th item of the How to create a new project paragraph.    




回答3:


After the update to visual studios there was updares to all my NuGet packages too. This included the DevExpress for Blazor NuGet package and with that update they changed the link to the dx-blazor.js and dx-blazor.css files that your supposed to put I your layout’s HEAD section.

From:

<link href="lib/dx-blazor.css" rel="stylesheet" />
<script src="lib/dx-blazor.js"></script>

To:

<link href="lib/dx-blazor/dx-blazor.css" rel="stylesheet" />
<script src="lib/dx-blazor/dx-blazor.js"></script>

Hope this maybe helps others in my situation or in a situation similar to mine.



来源:https://stackoverflow.com/questions/57593583/i-have-a-formlayout-error-when-running-a-blazor-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!