jcheng31 / DarkSkyApi

An unofficial C# library for the Dark Sky weather service. Targets .NET Standard 1.1.
MIT License
33 stars 18 forks source link

Add Windows 10 support #10

Closed anthonyhenderson closed 9 years ago

anthonyhenderson commented 9 years ago

First off, thanks for creating this library! Super useful.

When I upgraded my Windows 8.1 app to a Windows 10 universal app I got the following error when trying to add your NuGet package:

Not compatible with UAP,Version=v10.0 (win10-x64-aot)

jcheng31 commented 9 years ago

Hey, glad you're finding it useful :) I'll take a look at this in a bit.

jcheng31 commented 9 years ago

It seems the code itself is fine (i.e. it doesn't reference anything that can't be used in a Universal App), though the way I have the NuGet package set up is wrong. I'll fix this when I can, though I'm a bit busy right now so it might take a week or so. Sorry about that :(

In the meantime, a workaround would be to clone the project, building it, then adding a reference to the .dll directly - that should (I think) work. It does mean stepping outside the NuGet loop, though.

anthonyhenderson commented 9 years ago

Yea I figured I was simply a packaging issue but I wasn't familiar enough with NuGet to know where to start. No rush, I might try your workaround just to see if it works in general. Thanks!

jcheng31 commented 9 years ago

Alright, I've uploaded version 2.2 to NuGet, which should be packaged properly now (and also contains additional language support - see #9). Let me know if it works for you :)

anthonyhenderson commented 9 years ago

@jcheng31 Works perfectly. Thanks for the quick turnaround!

anthonyhenderson commented 9 years ago

Hey, so it looks like this works when building a Debug package but not when building a Release package in Visual Studio. I'm getting some compiler warnings:

warning : Assembly 'Microsoft.Threading.Tasks.Extensions' requests the address of the virtual method 'Stream.BeginRead(byte[], int, int, AsyncCallback, object)' which is not available in the targeted .NET platform. Please ask the author of 'Microsoft.Threading.Tasks.Extensions' to provide an implementation that can be used in the currently targeted .NET platform.
warning : Assembly 'Microsoft.Threading.Tasks.Extensions' requests the address of the virtual method 'Stream.EndRead(IAsyncResult)' ...
warning : Assembly 'Microsoft.Threading.Tasks.Extensions' requests the address of the virtual method 'Stream.BeginWrite(byte[], int, int, AsyncCallback, object)' ...
warning : Assembly 'Microsoft.Threading.Tasks.Extensions' requests the address of the virtual method 'Stream.EndWrite(IAsyncResult)' ...

Since you didn't write that assembly, I'm assuming it's just not supported for .NET native compilation for some reason. This is causing ForecastPCL not to be included in the final store packages that VS creates :(

My assumption here is that there's an extension method you're using that's causing this. I may try to fix this one myself and contribute for once but I wanted to share here in case something came to mind for you when you read these warnings :)

jcheng31 commented 9 years ago

Hmm, that's unfortunate :| I'll try take a look soon, but I'm definitely open to contributions!

I think that library is used as part of the async/await package I'm using for backwards compatibility - Microsoft.Bcl.Async - or one of its dependencies.

jcheng31 commented 9 years ago

Come to think of it, that library might not be necessary. If it only adds support for platforms the PCL doesn't target, we could probably just drop it entirely.

anthonyhenderson commented 9 years ago

Ok yea I'll keep trying to get it working. When I tried to build my app directly against your project I was seeing entirely different issues. Are the references (Microsoft.Bcl* etc.) supposed to be NuGet packages or something else? In VS2015 they look like regular references (different icon next to them).

jcheng31 commented 9 years ago

Yeah, they're NuGet packages.

anthonyhenderson commented 9 years ago

So I've been trying to build my project by directly referencing your code and I'm hitting this error:

2>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\IlcInternals.targets(791,7): warning : Method 'HttpClientHandler.set_AutomaticDecompression(DecompressionMethods)' was not included in compilation, but was referenced in method 'ForecastApi.GetCompressionHandler()'. There may have been a missing assembly.

Haven't figured it out yet but I thought I'd add the info here.

anthonyhenderson commented 9 years ago

Closing this issue as I've gotten closer to the root cause. Will open a more specific one.