GoogleApi icon indicating copy to clipboard operation
GoogleApi copied to clipboard

Library cannot be used in Blazor client side apps.

Open SykesJohn opened this issue 2 years ago • 30 comments

It looks like Net.Http.HttpClientHandler has some methods that are not supported when running in the browser.

It may be possible to refactor the library to use HttpClient or some other way to call the API that is supported. Other tools and libraries are able to make Google API calls from a web browser (e.g. Blazor web assembly).

Side note: HttpClient has many extension methods that could simplify the code.

SykesJohn avatar Jul 06 '22 18:07 SykesJohn

I am not sure what the specific problem is, but if you can send the failing code example or create a PR that fixes it, i will take a look

vivet avatar Jul 07 '22 19:07 vivet

Did you see my last comment, or maybe you figured out why your code didnt work?

vivet avatar Jul 21 '22 19:07 vivet

The root problem seems to be that the library is based on HttpClientHandler instead of HttpClient, or something like that. The former is not supported on the client side (e.g. Blazor web assembly). I will try to build a project to demonstrate. For now, I am using the library in a server side implementation.

SykesJohn avatar Jul 22 '22 11:07 SykesJohn

I am not sure a demo project will help me much, as I am not proficient in Blazor. You mention that the root problem is HttpClientHandler or something.... What exactly is the problem? Do you get a platformNotSupportedException ? If that's the case, then we must wait until it's supported, and you should use the server-side part for GoogleApi.

Let me know if you figure something out

vivet avatar Jul 25 '22 13:07 vivet

If you are interested, I have created a demonstration project where you can observe the issue: SykesJohn/GoogleApiDemo: Shows how GoogleApi does not work in client side Blazor. Replace "" with your key, (github.com)https://github.com/SykesJohn/GoogleApiDemo We may not need to wait for HttpClientHandler to be changed if HttpClient will do everything you need.

From: Michael Vivet @.> Sent: July 25, 2022 9:15 AM To: vivet/GoogleApi @.> Cc: Dubois, John @.>; Author @.> Subject: Re: [vivet/GoogleApi] Library cannot be used in Blazor client side apps. (Issue #291)

CAUTION: This Email is from an EXTERNAL source. Ensure you trust this sender before clicking on any links or attachments.

I am not sure a demo project will help me much, as I am not proficient in Blazor. You mention that the root problem is HttpClientHandler or something.... What exactly is the problem? Do you get a platformNotSupportedException ? If that's the case, then we must wait until it's supported, and you should use the server-side part for GoogleApi.

Let me know if you figure something out

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/vivet/GoogleApi/issues/291*issuecomment-1194033679__;Iw!!FFL0mGOO8SJQmAn-!MpAEXWUDoPEkAgOfGolNikQfd0YSq0lj3qHvOTh16BvauPgG7VXcgeLDXWysfqN1wQKqosP7KHEN0tYUhkQmZL5T1w$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AGEZ5VZHF22SDADYIIRR2C3VV2HNTANCNFSM522ULVZA__;!!FFL0mGOO8SJQmAn-!MpAEXWUDoPEkAgOfGolNikQfd0YSq0lj3qHvOTh16BvauPgG7VXcgeLDXWysfqN1wQKqosP7KHEN0tYUhkSwzkXBMQ$. You are receiving this because you authored the thread.Message ID: @.@.>>

SykesJohn avatar Jul 28 '22 15:07 SykesJohn

Okay, will take a look at it

vivet avatar Jul 28 '22 17:07 vivet

Hi @SykesJohn,

One thing you can try is to simply create your custom implementation of this class ( ServiceCollectionExtensions ) and provide your own implementation of HttpClient that don't rely on the HttpClientFactory.ConfigureDefaultHttpClient and HttpClientFactory.GetDefaultHttpClientHandler

   private static IServiceCollection AddApi<TClient>(this IServiceCollection services)
        where TClient : class
    {
        services
            .AddHttpClient<TClient>(HttpClientFactory.ConfigureDefaultHttpClient)
            .ConfigurePrimaryHttpMessageHandler(() => HttpClientFactory.GetDefaultHttpClientHandler())
            .SetHandlerLifetime(TimeSpan.FromMinutes(5));

        return services;
    }

Since it's only really a few lines ( ie one small extensions class ServiceCollectionExtensions with two methods ), I think you can easily create a class in your project to mimic this one and configure your HttpClient just the way you want.

Here is an example:


...
        services
            .AddApi<GoogleSearch.WebSearchApi>()
...

private static IServiceCollection AddApi<TClient>(this IServiceCollection services)
        where TClient : class
    {
        services.AddHttpClient<TClient>()
            .SetHandlerLifetime(TimeSpan.FromMinutes(5));

        return services;
    }

Have a great weekend.

========================================= FYI: The class provided with the library is configured this way to enable compressions

httpClientHandler.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;

cc: @vivet

bobbyangers avatar Aug 20 '22 12:08 bobbyangers

Hi

I tried you demo project and it works for me.

vivet avatar Aug 21 '22 07:08 vivet

Did you get both projects to work?

SykesJohn avatar Aug 29 '22 12:08 SykesJohn

I haven't had the time to look at it yet. It will be sone time before i get to it. I suggest you follow @bobbyangers suggestion, as you can customize as you like. It will be similar implementation i will do.

vivet avatar Aug 29 '22 14:08 vivet

Try and build this branch: https://github.com/vivet/GoogleApi/tree/VERSION_424

...and then use this when registering Google api's.

services
    AddGoogleApiClientsNoHandler()

if it works for you I will merge the branch and release and updated NuGet

vivet avatar Aug 31 '22 13:08 vivet

I’m seeing: 'IServiceCollection' does not contain a definition for 'AddGoogleApiClientsNoHandler' and no accessible extension method 'AddGoogleApiClientsNoHandler' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)

From builder.Services.AddGoogleApiClientsNoHandler();

From: Michael Vivet @.> Sent: August 31, 2022 9:23 AM To: vivet/GoogleApi @.> Cc: John Dubois @.>; Mention @.> Subject: Re: [vivet/GoogleApi] Library cannot be used in Blazor client side apps. (Issue #291)

This is an external email originating from outside of Sitel Group; do not click links or open attachments unless you know the content is safe.

Try and build this branch: https://secure-web.cisco.com/1TF9zZ0us5QWxrKMI95dlft4OutxkWh-VEK5Hw2TulEsa_zTSrug6UkTNRVNqknDxnfzdKNT8igpXnRc55egSciygfROdJmPBf4cUhidsxDv0JQ7yL26C-sgXSNlqS_-l_hQCRvaPjV7SsZ7qL_vc7ldKwjXCwQWQ6rFnqT6rID7KsjGQDyzAwaH4YZ3YgQjuSpCZmAs4iwY-JRtGRsCo0wqV5Wa127kcQ_oEdk7Yi5fdlHO6Vw7ZyY-341efBEiJBomkDqh0AmVJ4tvaprW8HlosgChF6XPmFL8cDuQgo-PpBnWF_epYnA9iRFLQck45/https%3A%2F%2Fgithub.com%2Fvivet%2FGoogleApi%2Ftree%2FVERSION_424

...and then use this when registering Google api's.

services

AddGoogleApiClientsNoHandler()

if it works for you I will merge the branch and release and updated NuGet

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/18Rj1hDCBHL6vXX4ZbLLnGMlAtpz14_lI2o55xI6negWnM3dl3uRTADzXgxjaplsrMAgzsvNrVexwy-FWXlpTIeaUAV2So2iqwYtpgKVyY88p2J857vDLNB50XWELhB959jFxPaIAyKtM2ImhI9vhgK8xaCdzJwwFYOKr0vwBeQBkiaK8-38MdKMZAX4Mku7DbPbnnEIekaHzcVjc0MUSbRVPk9p-a-bxvjHePLBW3-x9SvMNMNaQgeBRgbjdmFlSO6McUJxQcz8pJaczV8VA1T9x6upKF5fE5InxXr5Na7jAbJ7wxPNjT7jo8EQ6cvtb/https%3A%2F%2Fgithub.com%2Fvivet%2FGoogleApi%2Fissues%2F291%23issuecomment-1232933332, or unsubscribehttps://secure-web.cisco.com/197_QReXuBoYAHWx6gyj1fVHTaxJym7QfulKcuDJh-oEHXuMPql5ANXDnvj8kHSvoFgObHqfsuqh03oAm8yCRxvJ6GxlXG4drfZef_ZEBt01rSXYLFOuPQAImHJd_TkajbIn2TGESqDq7xz8LDNnSukIDitOFxoKSx5nMWqQ5fc408O3nYh7yX-B89p_rSYTtFy2TVMjBvoXSm9Do_eqBJDci_Aj6vSvSEbGA4MT8t76mTLicCJIJ1id43WHT66gBpy918r82w-nIPB5dcc9IxKk7yCX5cvwaB_3XkpOgVktpnge8D5xpaM0HOIH5E8-V/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEZ5V2XLBPOND4BN7OM4HTV35MD5ANCNFSM522ULVZA. You are receiving this because you were mentioned.Message ID: @.@.>>

SykesJohn avatar Aug 31 '22 13:08 SykesJohn

Seems your application is running with the nuget and not the lical build

vivet avatar Aug 31 '22 13:08 vivet

I am using the local, but I forgot to switch to the new branch before the build. Now I am trying to flush the NuGet cache…

From: Michael Vivet @.> Sent: August 31, 2022 10:00 AM To: vivet/GoogleApi @.> Cc: John Dubois @.>; Mention @.> Subject: Re: [vivet/GoogleApi] Library cannot be used in Blazor client side apps. (Issue #291)

This is an external email originating from outside of Sitel Group; do not click links or open attachments unless you know the content is safe.

Seems your application is running with the nuget and not the lical build

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/1Va0aOd9-T8Uh3tOJUFXIY2hq0eunmMzmfJ-X7MaO_PKq3SZV00jefyi2IWVNKp7EQj-x3qcKmbD9atM4Rc1rkJkHtlBcikIZ6qpigs7tRHjyuLTUv6XmQ6SncVB4035g0q_MuqEss0AavsiXa78K0bT6q7hxFONmY817HI0QZDmar1CtAFd3DaiMtAyhzsftQ4TfE9Kr0xHL3uL1Zi7-t2-zjPcOrgHDyQal4d0nVfwPcpb-qh1z6K8D_uY1XgoCuhHU9kdMJgKDoFPrV9jD1NnY7W3JJVXOdGk6HGblQG66EENCkEAEIHMsZOnWqMJ0/https%3A%2F%2Fgithub.com%2Fvivet%2FGoogleApi%2Fissues%2F291%23issuecomment-1232978357, or unsubscribehttps://secure-web.cisco.com/1rChr8P6ANh83bCk9eH1ChydNfYDTdYP4soQQXS5jigyeUGL6kAe_ZCURYshOsSAjZvru6LWxklZTBrDZVgwQmcoR6zaQLbm1g2lu4CwdXoi5_O6kb_2HmkSBUrwcTFHF5u3vIWbk9QZx1MIAPO3ih2sUFVbSTs8GYwJsdZKWPwgfhX6QX1ETBZD1b7G5xwv_sOuLyspXxpsCUApmgiDe04zb96D2GA5Ub3VdQtNya-M3_Q5Q-Eh_U1SXWoRMlxfWHT8ez0Y1c9egbXDXae3rrYUebFxRiyjw3nvweicm-yH4qISvuyMf0d2O7xPY-tCP/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEZ5V352GTU3T73FUPSPR3V35QOBANCNFSM522ULVZA. You are receiving this because you were mentioned.Message ID: @.@.>>

SykesJohn avatar Aug 31 '22 14:08 SykesJohn

I got it building and recognizing the new service (builder.Services.AddGoogleApiClientsNoHandler();), but I still see this in the console logs: System.PlatformNotSupportedException: Operation is not supported on this platform.

From: Michael Vivet @.> Sent: August 31, 2022 10:00 AM To: vivet/GoogleApi @.> Cc: John Dubois @.>; Mention @.> Subject: Re: [vivet/GoogleApi] Library cannot be used in Blazor client side apps. (Issue #291)

This is an external email originating from outside of Sitel Group; do not click links or open attachments unless you know the content is safe.

Seems your application is running with the nuget and not the lical build

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/1Va0aOd9-T8Uh3tOJUFXIY2hq0eunmMzmfJ-X7MaO_PKq3SZV00jefyi2IWVNKp7EQj-x3qcKmbD9atM4Rc1rkJkHtlBcikIZ6qpigs7tRHjyuLTUv6XmQ6SncVB4035g0q_MuqEss0AavsiXa78K0bT6q7hxFONmY817HI0QZDmar1CtAFd3DaiMtAyhzsftQ4TfE9Kr0xHL3uL1Zi7-t2-zjPcOrgHDyQal4d0nVfwPcpb-qh1z6K8D_uY1XgoCuhHU9kdMJgKDoFPrV9jD1NnY7W3JJVXOdGk6HGblQG66EENCkEAEIHMsZOnWqMJ0/https%3A%2F%2Fgithub.com%2Fvivet%2FGoogleApi%2Fissues%2F291%23issuecomment-1232978357, or unsubscribehttps://secure-web.cisco.com/1rChr8P6ANh83bCk9eH1ChydNfYDTdYP4soQQXS5jigyeUGL6kAe_ZCURYshOsSAjZvru6LWxklZTBrDZVgwQmcoR6zaQLbm1g2lu4CwdXoi5_O6kb_2HmkSBUrwcTFHF5u3vIWbk9QZx1MIAPO3ih2sUFVbSTs8GYwJsdZKWPwgfhX6QX1ETBZD1b7G5xwv_sOuLyspXxpsCUApmgiDe04zb96D2GA5Ub3VdQtNya-M3_Q5Q-Eh_U1SXWoRMlxfWHT8ez0Y1c9egbXDXae3rrYUebFxRiyjw3nvweicm-yH4qISvuyMf0d2O7xPY-tCP/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEZ5V352GTU3T73FUPSPR3V35QOBANCNFSM522ULVZA. You are receiving this because you were mentioned.Message ID: @.@.>>

SykesJohn avatar Aug 31 '22 14:08 SykesJohn

Hi

Not sure I can do much more. You can try experiment wirh code base, and see if can figure it out.

vivet avatar Sep 01 '22 05:09 vivet

you are injecting the api's and not using the facede, right?

vivet avatar Sep 01 '22 05:09 vivet

The only change I made to my GoogleApiDemoWASM project was to add

builder.Services.AddGoogleApiClientsNoHandler();

To Program.cs and update the NuGet. Were any other changes required?

Did you get the project to run?

From: Michael Vivet @.> Sent: September 1, 2022 1:54 AM To: vivet/GoogleApi @.> Cc: John Dubois @.>; Mention @.> Subject: Re: [vivet/GoogleApi] Library cannot be used in Blazor client side apps. (Issue #291)

This is an external email originating from outside of Sitel Group; do not click links or open attachments unless you know the content is safe.

you are injecting the api's and not using the facede, right?

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/1JKmGRua2ScsVTQVJ8fJC24IP9ytJtE9lJyKuDLktWt9u4U2_Dro9QVej8MZyLPboFHY1khSn_TDIRjnNhGcXxEKEUcWw7p8p8jn67W2-bi87B0kY5cOXIunuTIAer0TAEcWmybmYN0BaqUFPxOrjPW7hGrQC0xjxPb5qNhF_Y8eXkL3JoruMmHa0YAUGeB7ocnwiLpsIKn2zdzCZ7ZUKAOPDWLdjWuXHZRwrItPQYHJFKyMeo6zs8bwFLf0V5NGDjdz0yQJOYtOjuz9umJjuEvCdDKytHvb_njNtjYxx1njhdY15lWHpNwE_38WJFAyK/https%3A%2F%2Fgithub.com%2Fvivet%2FGoogleApi%2Fissues%2F291%23issuecomment-1233774366, or unsubscribehttps://secure-web.cisco.com/1Vv6PIDsNUhbzqUdgFt1T7VuAzurR9OX851Bai3flTp-n1jglq129L5NSTq9vga2NCrrTI5swa9rUcx2ZzqVkWSeGf_WPeonGySXYV8lvhbZShRY5nykrveJ2l6lpMF0RBxJ5N2liHx84GF1foCKGAWsybpxyrEuKaLsrkLGYjuZzUYwZLiEg7UiWxW7hXr87DsGGZqp-sx8D0zAv2rfYBXlBUPGVU2pGvJfsIMVyAahye46n9lIDbuM3fBUL_JeiPPu40TCMUMUzXaY5eQ-aOL7cdEvI5l7FqqeQIUzhK0TuX-1a_2Gy-lpW47OWUDdG/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEZ5V3GBVM25AAAYNWAJ4DV4BAI5ANCNFSM522ULVZA. You are receiving this because you were mentioned.Message ID: @.@.>>

SykesJohn avatar Sep 01 '22 11:09 SykesJohn

You need to inject the api you want to use

vivet avatar Sep 01 '22 15:09 vivet

If you are doing: GoogleMaps.Directions.Query(...), then it's wrong for what you are trying to accomplish

vivet avatar Sep 01 '22 15:09 vivet

I tried injecting the API like this in the AutoComplete.razor.cs:

  [Inject]
  public GoogleApi.GooglePlaces.AutoCompleteApi? autoComplete { get; set; }

and calling like this:

var list = await autoComplete.QueryAsync(req);

but the page won’t even render.

From: Michael Vivet @.> Sent: September 1, 2022 11:50 AM To: vivet/GoogleApi @.> Cc: John Dubois @.>; Mention @.> Subject: Re: [vivet/GoogleApi] Library cannot be used in Blazor client side apps. (Issue #291)

This is an external email originating from outside of Sitel Group; do not click links or open attachments unless you know the content is safe.

If you are doing: GoogleMaps.Directions.Query(...), then it's wrong for what you are trying to accomplish

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/15JBfjfJBbkDS1SnzJ51HSyzJ3E8zgtKL9uSOQCZiI5AvN3Mf2PS3rHhk2ZCsCYH66GDSNRkhsSbv5hCduv88Paz6zwo4I95vbtaJuK8rptOq2IJfg3M7Inr3D1VyjcXVdfQKPmmnCYCG_yb6dVHfMWzIbQwih90gj8gvBaMV0faJrhq5X64fwV1ckPXgd2x6HLzn0Bl91xotNLPkhQUh-Vmy7FJJ5gBymzuLwxuhyPYiSqrvcwUAUmyqznHYqjqa5YEGhT0LaKTOQE-AP1u0BrFDni-5cB27djYGXwH5sn8z3EmVjjeGS8_KmnQgezyd/https%3A%2F%2Fgithub.com%2Fvivet%2FGoogleApi%2Fissues%2F291%23issuecomment-1234467766, or unsubscribehttps://secure-web.cisco.com/1r54NOeDI5OEdMFtCD9qHTX92-vev7GGOZ_PpS23aATKMvkgapRVUcb1xlVtPHuxYz4_IdOQzsM_HJPI6bhG59E9OvBbqnbOQG9fFANqG1VNib0EUg-g_f1vtPmdJL_i_-FZ6fO6GDHn2Wp04A7pH9iwJuXeGi20Ib7ekVeVheaEgxKzCIHy34CeerqX2mq352hUWehA7CVXrlUWCVnZlSAmrSG3korXXa7UYi1kQhY04WTWZsF1KFLTTh8Gm8xviEAJFwNwCEAtdeG9sEfmejs-nm9sVsUUcfwvcc_0BMARZYXKhqCkszbIhimZ25Crk/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEZ5V7SQUKAFGHPAPL2CJDV4DGCDANCNFSM522ULVZA. You are receiving this because you were mentioned.Message ID: @.@.>>

SykesJohn avatar Sep 01 '22 16:09 SykesJohn

QueryAsync 😀

... Sorry didn't see you already used QueryAsync. Try add .ConfugureAwait(false)

vivet avatar Sep 01 '22 16:09 vivet

Do you have a version of the Blazor project that works?

SykesJohn avatar Sep 01 '22 18:09 SykesJohn

I didn't try. Try add .ConfugureAwait(false)

vivet avatar Sep 02 '22 05:09 vivet

Hi again I took a look at your project.

Let me start from the beginning. GoogleApi can be used in two different ways. First, you can use the static facade implementation, to invoke request. Like this:

GoogleApi.GooglePlaces.AutoComplete.QueryAsync(req);

When using the facade, you are invoking the default constructor in the HttpEngine, and will use the default HttpClient, that initializes the HttpClientHandler. That seems to cause problems for you, so don't use this method. I can see in your demo project, that you are using GoogleApi this way (https://github.com/SykesJohn/GoogleApiDemo/blob/master/GoogleApiDemo/Pages/AutoComplete.razor.cs#L33). Maybe you didn't push your last changes, cause your messages indicates that you changed the implementation to using GoogleApi with dependency injection?

Anyhow, you need to use dependency injection, like this: In the startup

services
    AddGoogleApiClientsNoHandler();

Then in your constructor you inject the api you want to use. In your case it's ``GooglePlaces.AutoComplete```.

public class MyClass
{
    private GooglePlaces.AutoComplete autoComplete;
    public MyClass(GooglePlaces.AutoComplete autoComplete)
    { 
        this.autoComplete  = autoComplete
    }
}

Last, in your logic you use the autoComplete.

this.autoComplete.QueryAsync(request).ConfigureAwait(false);

You need to add the .ConfigureAwait(false), otherwise your UI will block (as far as I know), as it seems was your recent problem.

If it still doesn't work, I am out of ideas. Note, that I never work with frontends, so my knowledge here is limited. Hope it helps.

vivet avatar Sep 03 '22 06:09 vivet

I have made the changes you recommended, except that Blazor classes must have parameter-less constructors. I used the @inject directive to get the API.

I have pushed the changes for you to see.

From: Michael Vivet @.> Sent: September 3, 2022 2:27 AM To: vivet/GoogleApi @.> Cc: John Dubois @.>; Mention @.> Subject: Re: [vivet/GoogleApi] Library cannot be used in Blazor client side apps. (Issue #291)

This is an external email originating from outside of Sitel Group; do not click links or open attachments unless you know the content is safe.

Hi again I took a look at your project.

Let me start from the beginning. GoogleApi can be used in two different ways. First, you can use the static facade implementation, to invoke request. Like this:

GoogleApi.GooglePlaces.AutoComplete.QueryAsync(req);

When using the facade, you are invoking the default constructor in the HttpEngine, and will use the default HttpClient, that initializes the HttpClientHandler. That seems to cause problems for you, so don't use this method. I can see in your demo project, that you are using GoogleApi this way (https://secure-web.cisco.com/1XtvleR3Karel2mSNrooI0kZAtAyhYdgtS9BaAbyzbchIYD4Ff-Z92uW4RIdhVwei4ZoWmDYqUVJbH_4vlE6fP1kPEYgeeqqbe9HkBIAPUH_dnkT9vrT1IxOiqNDXxDVa76SY-DALTpnEhyx4xQKw7gnuqw544aljya9awKx4ZGVMCUwbuVqGWVyT7lUZ5Ph2np00cMzY41aCt5pHob1chlCLSU1niYf9Bexa0L9jQ0r_Zs6NrHLs5pfZ75fA8Z4kcdhAI0sh-3ThKELATrz7OrD8SIiT5ZXvGg7uWN2IrLXaYf4XJ21LoDu8A74TWu7U/https%3A%2F%2Fgithub.com%2FSykesJohn%2FGoogleApiDemo%2Fblob%2Fmaster%2FGoogleApiDemo%2FPages%2FAutoComplete.razor.cs%23L33). Maybe you didn't push your last changes, cause your messages indicates that you changed the implementation to using GoogleApi with dependency injection?

Anyhow, you need to use dependency injection, like this: In the startup

services

AddGoogleApiClientsNoHandler();

Then in your constructor you inject the api you want to use. In your case it's ``GooglePlaces.AutoComplete```.

public class MyClass

{

private GooglePlaces.AutoComplete autoComplete;

public MyClass(GooglePlaces.AutoComplete autoComplete)

{

    this.autoComplete  = autoComplete

}

}

Last, in your logic you use the autoComplete.

this.autoComplete.QueryAsync(request).ConfigureAwait(false);

You need to add the .ConfigureAwait(false), otherwise your UI will block (as far as I know), as it seems was your recent problem.

If it still doesn't work, I am out of ideas. Note, that I never work with frontends, so my knowledge here is limited. Hope it helps.

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/1YTP6mj3vtzx6EcVD9jrixi_KXXQvKCwXqLPihodxvU-_04-KVe2kXZ6ztAvuAnRDA157X-ZJKZ467KX-hHCWYQyrIAY6aFz5crIpxuxMbesURSoyJfOtC2qTV7tQ1JRbTOmUALJ_ftQe2fjqJnjaTF-P7QU2e8zp11XnR53sm5GOnOHv1B7baGbKbrZR1-cwG7sTGTftrEm7c_emTD3zwNfLBT1b0Jw6lgYqRx65HAK3shfStxbdVGAUdHS2TzzBsmD_LAt05g4GfDu3nSGBMQzHLF08lqyPTMxnVaaNPQpfIdPFHpGLCd_Rk4TbVa-6/https%3A%2F%2Fgithub.com%2Fvivet%2FGoogleApi%2Fissues%2F291%23issuecomment-1236059345, or unsubscribehttps://secure-web.cisco.com/1W3HR--5u83two2WkaOTnFzV2JxYpg1PDdJGgUvBoFvgbGYH5x6YgC1RxwwqcgB7nyBSaXXa7vffmO9I3gOQij-NwIYRHSKZu6Mz6VJmbbSmHY6qehMp7np40rbU5Cv8sfukWsqcO9KHobr_6G-3hGu0sNPDF5FIQgj0OzZ3lpIripDj1NhQ8XhmWRV80Wl51oTLr8i5oLp9BhokQcCBCdORP0uh0sUUe24EisgsNNKxrk4do3HhARWRs9ICacIIVGMhkR739xCHmMahna7NwxtHk6DzN9PIcsZCP27P5EqbT5Lnq_7Vs2zZ8bBuzpWeG/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEZ5V6NEDE3F3OP4WRNP43V4LVS5ANCNFSM522ULVZA. You are receiving this because you were mentioned.Message ID: @.@.>>

SykesJohn avatar Sep 07 '22 11:09 SykesJohn

Okay, and it works?

vivet avatar Sep 07 '22 13:09 vivet

I haven't tried your demo project, just looked at the code, and then made the implementation without the HttpClientHandler as requested. I am sorry, but I can't spent more time on this. Feel free to make a pull-request if you can figure out why it doesn't work for you.

vivet avatar Sep 07 '22 13:09 vivet