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

Readme update and NullReferenceException #10

Open
hannespreishuber opened this issue Sep 25, 2019 · 1 comment
Open

Readme update and NullReferenceException #10

hannespreishuber opened this issue Sep 25, 2019 · 1 comment

Comments

@hannespreishuber
Copy link

try to get it run with 3.0 final
protected override async Task OnInitAsync()
should be in readme.md
protected override async Task OnInitializedAsync()

but at this point I get a
NullReferenceException: Object reference not set to an instance of an object.
Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(long asyncHandle, string identifier, string argsJson)
Microsoft.JSInterop.JSRuntime.InvokeAsync(string identifier, CancellationToken cancellationToken, object[] args)
Microsoft.JSInterop.JSRuntime.InvokeWithDefaultCancellation(string identifier, object[] args)
System.Threading.Tasks.ValueTask.get_Result()
System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult()
AspNetMonsters.Blazor.Geolocation.LocationService.GetLocationAsync() in LocationService.cs
+
var result = await jSRuntime.InvokeAsync("AspNetMonsters.Blazor.Geolocation.GetLocation", requestId);
UseGeo.Pages.Index.OnInitializedAsync() in Index.razor
+
location = await LocationService.GetLocationAsync();

@aleksandar-smilevski
Copy link

Hi @hannespreishuber,

I ran into a similar (the same) issue, when trying to read the location of the user using the LocationService. This is the error in the console:

image

I found a workaround by copying the Location.js in the wwwroot of my application

And then referencing it in my index.html or _Host.cshtml (if you're using Blazor Server Side).

However, I think when installing the NuGet package the file should be copied to your wwwroot.

Hope that helps :)

P.S. I am a Blazor novice and someone more experienced may give better advice. I am just sharing what fixed my issue

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

No branches or pull requests

2 participants