Coder Social home page Coder Social logo

Server-side Issue about blazorgooglemaps HOT 40 CLOSED

rungwiroon avatar rungwiroon commented on August 14, 2024
Server-side Issue

from blazorgooglemaps.

Comments (40)

Redeye51 avatar Redeye51 commented on August 14, 2024 1

I added you Nuget package got it to compile but when I ran it I get the following error
image

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024 1

@Karluzo this is not mine. This is @rungwiroon . I will delete it aslo from repository

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024 1

@Karluzo Lets clarify scenarios which isnt working for you.

  1. Create server side Blazor project. Then create component in shared folder using BlazorGoogleMaps and using it in in razor pages you get error. I will investigate this scenario
  2. What do you mean normal pages project? Could you write down steps how we could try reproduce it?

from blazorgooglemaps.

Cameron097 avatar Cameron097 commented on August 14, 2024 1

Ive been having this issue and I fixed it by changing the Rendermode to Server in the host file. If it is set to ServerPrerendered it will not work (was getting exactly the same object reference error as shown above). Hope this helps :)

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024 1

@Cameron097 yes i will add. This week was pretty busy. Hope next week will have more time and will udpdate docs

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

There is issue with embedding local JavaScript to server side applications. Will update soon

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

Thanks for the response

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

I saw there was a fork created to attempt a fix for this. Any luck?

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

I am fallowing procedure to wait for confirmation of valid code. Made pull request. As short workaround you could try add this nuget Vlasdkoqw. I was testing if my fix helped with this nuget. Just add later will need just to replace nuget after our release. I could update here when we release update.

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

Here's the page code.

@page "/maptest"
@using GoogleMapsComponents.Maps
@using Vlasdkoqw

Google Map

<GoogleMap @ref:suppressField @ref="@map1" Id="map1" Options="@mapOptions">

@functions {
private GoogleMap map1;
private MapOptions mapOptions;

protected override void OnInitialized()
{
    mapOptions = new MapOptions()
    {
        Zoom = 13,
        Center = new LatLngLiteral()
        {
            Lat = 13.505892,
            Lng = 100.8162
        },
        MapTypeId = MapTypeId.Roadmap
    };
}

}

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

I updated readme a bit. Did you added script tag to _Host.cshtml also google script tag (with your key of course)? Do you use preview8?

<script src="_content/Vlasdkoqw/objectManager.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&v=3"></script>

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

I had the google api URL but I didn't have the objectManager.js in the _Host.cshtml file. I added that and tried it again. Same result.

I also have services.AddBlazorGoogleMaps(); in my Startup.cs

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

From small stack trace part i see that error comes not from component itself. Could you try create new solution and fallow steps i provided. In your case I think it could be some conflicts in preview libraries. Please check github.com/dotnet/aspnetcore/issues/13133 and maybe it could help to solve issue.

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

Does issue still exist in preview 9.
Temporally i update lib to other package while i get access to update this lib packages
https://www.nuget.org/packages/Vlasdkoqw/1.0.2

Please fallow migration instructions and let me know
https://devblogs.microsoft.com/aspnet/asp-net-core-and-blazor-updates-in-net-core-3-0-preview-9/

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

I dont see screen shot. Could you copy past stack trace?

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

I tried to recreate scenario to get exception. I go very similar result when i dont put script tags into _Host.cshtml
Could you confirm that these lines exist in _Host.cshtml file?
Ps please change YOUR_KEY with your google key

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&v=3"></script>
<script src="_content/Vlasdkoqw/objectManager.js"></script>

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

I am lost. I dont know hot to help. Last thing, could you try add simple component like this with preview9 or rc1 and let me know if it works

@page "/counter"
@using GoogleMapsComponents
@using GoogleMapsComponents.Maps

<h1>Counter</h1>

<GoogleMap @ref="@map1" Id="map1" Options="@mapOptions"></GoogleMap>


@code {

    private GoogleMap map1;
    private MapOptions mapOptions;

    protected override void OnInitialized()
    {
        mapOptions = new MapOptions()
        {
            Zoom = 13,
            Center = new LatLngLiteral()
            {
                Lat = 13.505892,
                Lng = 100.8162
            },
            MapTypeId = MapTypeId.Roadmap
        };
    }
}

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

I think you need map options. It should work without it. Could you try to start new solution. Add that component #7 (comment) . Add lines to _Host.cshtml if it wont work please add to zip and upload here.

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

@rungwiroon hey man please update nuget.
@Redeye51 awesome. Happy to hear. If you will have some issues let me know. I had been using it at some aspects. I also could help solve some other issues related to maps.

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

rungwiroon avatar rungwiroon commented on August 14, 2024

@valentasm1
I will update it tonight.

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

@rungwiroon I also updated solution to 3.0.0 and recreated demos. Also added Guid to polyline. Had case when needed access it from local js. I think we should think about other solutions in future.

from blazorgooglemaps.

rungwiroon avatar rungwiroon commented on August 14, 2024

I already started work for better JS objects interop but don't have time to finish it yet.

from blazorgooglemaps.

rungwiroon avatar rungwiroon commented on August 14, 2024

I've uploaded the new nuget package version 4.6.0-alpha.
Please help to check if it works correctly.

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

Redeye51 avatar Redeye51 commented on August 14, 2024

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

I could confirm that it works for me. Client side version.

from blazorgooglemaps.

Karluzo avatar Karluzo commented on August 14, 2024

@valentasm1 You should delete your Google maps API key from this public chat.

from blazorgooglemaps.

Karluzo avatar Karluzo commented on August 14, 2024

I have the same problem. I have created empty Blazor project, added latest alpha version and modified _Host.cshtml file. I have observed that when I put the my razor component in Shared folder (with no _Host.cshtml in it) I get the error. Otherwise I do not get the error - in Pages folder. Still I can get only the text "Sorry, there's nothing at this address."
When I am trying to make the BlazorGoogleMaps work in normal Razor pages project (but in a razor component), there is no _host.cshtml to modify and I am getting still the error.

from blazorgooglemaps.

Karluzo avatar Karluzo commented on August 14, 2024

Thanks, I am learning razor and blazor and I am using this scenario for my project - using razor components in a razor page:
https://www.mikesdotnetting.com/article/338/using-razor-components-in-a-razor-page
using RenderComponentAsync.

from blazorgooglemaps.

Cameron097 avatar Cameron097 commented on August 14, 2024

May be worth adding that to the docs until a work around is found or maybe that's just how it's meant to be?

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

@Karluzo do you still have issue after apply RenderComponentAsync ?

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

@Karluzo do you still have issue after apply RenderComponentAsync ?
Could i close issue?

from blazorgooglemaps.

valentasm1 avatar valentasm1 commented on August 14, 2024

Closing due inactivity

from blazorgooglemaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.