问题
I am creating a c# form application(It's important to note that it's not a mobile app cause I think that is part of the issue). I am trying to use the Windows devices geolocation libraries and I am running into the issue that the code given on the microsoft website doesn't work.
GeolocationAccessStatus accessstatus = await Geolocator.RequestAccessAsync();
This code should work fine but I get the error "IAsyncOperation does not contain a method for getawaiter and no extension method accepting a first argument of IAsyncOperation" What is causing this. I know it says that you need using system in the declarations but I have that so it can't be that. What is causing the issue? Note the method it's called in is private async static void MainGeomethod()
so it can't be that either. Any advice as to what is causing this issue?
回答1:
After some looking I found that the assembly file I needed was actaully not on the list of possible references but had to be found in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
来源:https://stackoverflow.com/questions/38750835/geolocation-get-location-async-cannot-be-awaited