Daddoon / BlazorMobile

Create full C# driven hybrid-apps for iOS, Android, UWP & Desktop with Blazor!
MIT License
413 stars 55 forks source link

MacOS error while starting the Blazor.Server-Project #216

Open baristikir opened 4 years ago

baristikir commented 4 years ago

I am using Visual Studio 2019 for MacOS and just followed the getting started section of the readme. Creating a project and trying to debug without doing any changes to it. Selecting Blazor.Server project and debugging gave me couple of errors and the website was only on "Loading..." .

Inspecting it in the Browser gave me these errors:

[2020-06-24T21:47:46.294Z] Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json' or set 'CircuitOptions.DetailedErrors'. 

The package manager integrated in Visual Studio gave me these errors:

Microsoft.JSInterop.JSException: Could not find 'BlazorXamarin' in 'window'.
Error: Could not find 'BlazorXamarin' in 'window'.
    at http://localhost:5080/_framework/blazor.server.js:8:30748
    at Array.forEach (<anonymous>)
    at p (http://localhost:5080/_framework/blazor.server.js:8:30709)
    at http://localhost:5080/_framework/blazor.server.js:8:31416
    at new Promise (<anonymous>)
    at e.beginInvokeJSFromDotNet (http://localhost:5080/_framework/blazor.server.js:8:31390)
    at http://localhost:5080/_framework/blazor.server.js:1:19202
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (http://localhost:5080/_framework/blazor.server.js:1:19173)
    at e.processIncomingData (http://localhost:5080/_framework/blazor.server.js:1:17165)
   at Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation[T](String identifier, Object[] args)
   at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
   at BlazorMobile.Common.Components.BlazorMobileComponent.SetRemoteDebugEndpoint()
   at BlazorMobile.Common.Components.BlazorMobileComponent.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
The thread 1421905 has exited with code 0 (0x0). 

I don't actually know what the problem is. I have updated the xamarin forms too. I was trying to work with the iOS project. I am using xcode-simulator as debugging option for that and therefore I tried to debug the Server to get it running.

Daddoon commented 4 years ago

BlazorMobile default deployment has never been tested on MacOS. I can't guarantee for now that all the pipeline is working as expected.

There is some events that should be done at build time, same, i never tested on it.

For the BlazorXamarin error, can you double check that your project is loading blazormobile.js in your index.html file ? Also i think your first reported error is just a consequence of the second one you mentionned, as an exception has been thrown during the initial rendering.

Otherwise, keep in mind that the iOS deployment will not work on the simulator (at least the Web part, native is ok) because Apple decided to not support WebAssembly inside the iOS Simulator. So yes, if you don't have any Apple device, you can at least test the remote debugging functionnality with Server mode on MacOS and Native in the simulator.

I will try to do some test on my Mac tomorrow to see why it doesn't work by default.

baristikir commented 4 years ago

Thank you so much for the quick response. I didn't know that the iOS Simulator isn't supporting WebAssembly, good to know this thanks. I. will try this later on but I tried it also on my Windows PC and by default I am getting the same error when I start the BlazorMobile.Server . The blazormobile.js is in index.html as Githubissues.

  • Githubissues is a development platform for aggregating issues.