google-maps: System.InvalidOperationException within DownloadDataTaskAsync
Not really sure whats going off here, but i have a feelings its because the library is using an async void method without having a async context?
The DownloadDataTaskAsync
method is currently using public WebClient.DownloadDataAsync(Uri address)
and I’m guessing it just needs changing to use the one that returns a Task object - WebClient.DownloadDataTaskAsync(Uri address)
Details are below:
Exception thrown: 'System.InvalidOperationException' in GoogleMapsApi.dll
Additional information: An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.
Stack Trace:
at System.Web.AspNetSynchronizationContext.OperationStarted()
at System.Net.WebClient.DownloadDataAsync(Uri address, Object userToken)
at System.Net.WebClient.DownloadDataAsync(Uri address)
at GoogleMapsApi.WebClientExtensionMethods.DownloadDataTaskAsync(WebClient client, Uri address, TimeSpan timeout, CancellationToken token) in c:\code\google-maps\GoogleMapsApi\WebClientExtensionMethods.cs:line 119
at GoogleMapsApi.Engine.MapsAPIGenericEngine`2.QueryGoogleAPIAsync(TRequest request, TimeSpan timeout, CancellationToken token) in c:\code\google-maps\GoogleMapsApi\Engine\MapsAPIGenericEngine.cs:line 120
at GoogleMapsApi.EngineFacade`2.QueryAsync(TRequest request, CancellationToken token) in c:\code\google-maps\GoogleMapsApi\GoogleMaps.cs:line 215
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (17 by maintainers)
@kevbite I’m closing, let us know if need to reopen