DavidArno / SuccincT

Discriminated unions, pattern matching and partial applications for C#
MIT License
266 stars 15 forks source link

Hard dependency on System.Runtime 4.1.0 #18

Closed megafinz closed 7 years ago

megafinz commented 7 years ago

I was trying to use it in a WPF application targeting .Net Framework 4.6.1, but it crashed when code reached usage of SuccincT. Exception details imply that it wants System.Runtime.dll 4.1.0.0 but I had only 4.0.0.0 available in GAC. I had to install .Net 4.6.2 Developer Pack and retarget all my assemblies to 4.6.2 instead of 4.6.1, so I am able to install System.Runtime package from NuGet. The latest version is 4.3.0, but unfortunately app still crashed when I tried to use that. I downgraded the package to 4.1.0 and that fixed the issue for me.

It appears that SuccincT is bound strictly to 4.1.0.0.

DavidArno commented 7 years ago

Looking through various files:

SuccincT\SuccincT.csproj contains <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> SuccincT.Core\project.json depends on "NETStandard.Library": "1.6.0" SuccincT\SuccincT.nuspec and SuccincT\nuget-pack.bat bundle SuccincT.dll and SuccincT.Core.dll into the nuget package...

but, SuccincT.Core\SuccincT.Core.xproj contains a <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> reference. Which is odd as my intention was that SuccincT.Core.dll only targeted dotnetcore.

So between me not knowing what I'm doing and Visual Studio possibly trying to be helpful, something has gone wrong. I had previously noted that with a framework 4.5.2 project that it seemed to use the dotcore dll, but I put that down to me misreading things. It doesn't explain you finding a hard dependency on v4.1, but I now know where to start trying to fix things.

I'm working on a new release to address @rubiktubik's request for JSON serialisation support (#17), so will aim to bundle a fix for this issue too in that release.

DavidArno commented 7 years ago

Update on this.

I created a .NET Framework 4.6.2 test project and added Succinc<T> via nuget. This added a dependency to SuccincT.Core.dll. Running it, it does indeed die with an error complaining it's dependent on System.Runtime v4.1. I then pointed it directly at the SuccincT.dll and it all worked correctly. So .NET Framework projects do pick up the wrong version of the dll.

I have no idea at this stage how to fix this though. So I've sought help on Stack Overflow. Hopefully I'll get a good answer there and will be able to fix this.

DavidArno commented 7 years ago

Further investigations has revealed:

  1. Succinc<T> only works with projects that target framework v4.0 or Windows 8 (not 8.1). Every other framework results in this system runtime incompatibility problem.
  2. I can hard-code dependencies into the .nuspec file to force the use of SuccincT.dll for framework v4.5+, Win 8.1+ etc.
  3. However, and this is the killer, I can't work out how to create a test project for dotnet core that is both compatible with Succinc<T> and any sort of testing framework. So I've no real idea if the core version even works with any real dotnet core project.

As the next release, v2.2, was going to be an update for JSON.Net support (which won't include dotnet core), I am going to therefore drop support for dotnet core with this release. That way I can go ahead and release next week.

DavidArno commented 7 years ago

Succinc\<T> v2.2.0 is now available on nuget. This release removes the dependency on .NET Core and thus fixes this issue.