Fsharp: [Updated] .NET Framework app crashes at runtime when referencing a .NET Standard library

Created on 25 Jan 2018  Â·  39Comments  Â·  Source: dotnet/fsharp

F# applications cannot run on 15.6 Preview 3:

image

To repro:
ConsoleApplication18.zip

Using the above project, ctrl-f5.

Old issue

System.IO.FileLoadException: Could not load file or assembly 'FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name validation failed. 

https://www.nuget.org/packages/FSharp.Core/

What's going on here?

Area-Infrastructure Area-Library Severity-Medium

All 39 comments

System.IO.FileLoadException: Could not load file or assembly 'FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A) ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)

yes same here. reverting paket upgrade.

After being notified about this and after reviewing the above I decided to unlist the package https://www.nuget.org/packages/FSharp.Core/4.3.0.

"The package has been unlisted. It may take several hours for this change to propagate through our system."

Ouch!!!!

It turns out that we started creating the nuget packages before we sign the assemblies in them. @brettfo and I will see what we need to do to fix that.

This was missed because sn-Vr is still in widespread use, curses ... and ... dotnet cli doesn't really care about the signing hashes.

Sorry for the inconvenience, we will address it quickly.

Kevin

On the bright side: this was caught quickly after release. Also it's nice
that a netstandard 2 version is coming.

Am 25.01.2018 19:51 schrieb "Kevin Ransom (msft)" <[email protected]

:

Ouch!!!!

It turns out that we started creating the nuget packages before we sign
the assemblies in them. @brettfo https://github.com/brettfo and I will
see what we need to do to fix that.

This was missed because sn-Vr is still in widespread use, curses ... and
... dotnet cli doesn't really care about the signing hashes.

Sorry for the inconvenience, we will address it quickly.

Kevin

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/visualfsharp/issues/4263#issuecomment-360562607,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNEVR6U6ZDyYllPk9V1cU-pwwz6jAks5tOM0TgaJpZM4RsbRC
.

Okay ... pushed 4.3.1 to nuget with signed binaries.

@forki, The serialization issue was a compiler bug, that is now fixed and does not require a netstandard 2.0 build. The fix should be shipped in the next preview.

But there was a change in dependencies in the nuspec that looked like you
shipped 2.0 support.

Am 25.01.2018 23:10 schrieb "Kevin Ransom (msft)" <[email protected]

:

Okay ... pushed 4.3.1 to nugget with signed binaries.

@forki https://github.com/forki, The serialization issue was a compiler
bug, that is now fixed and does not require a netstandard 2.0 build.
Should be shipped in the next.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/Microsoft/visualfsharp/issues/4263#issuecomment-360617401,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNNNKKzrLXudM6r_Jx6hREzkPKeCWks5tOPvFgaJpZM4RsbRC
.

Ok where is the difference between 4.3.1 package and 4.3.2 package?

This seems to be fixed. (At least our build is now green again) Thank you very much!

Closing as the immediate issue is fixed. Linking #4269 as the long-term solution

From Preview 3

image

Yes I also saw issues when I pushed to azure functions. I suggest we unlist 4.3.x

@forki, What were the issues?

It could not find the dll while I was pretty sure it was alongside. Paket
downgrade of fsharp.core fixed it immediately.

Am 30.01.2018 08:38 schrieb "Kevin Ransom (msft)" <[email protected]

:

@forki https://github.com/forki, What were the issues?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/visualfsharp/issues/4263#issuecomment-361502127,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNFPifcQ4-WFidJcy34S939pWNKuUks5tPsbwgaJpZM4RsbRC
.

Could it not find the FSharp.Core.dll or was there a manifest error or signing error?
What was the .exe?
Was it coreclr or desktop, if desktop what was the app.config?

It said it could not find it - without further details shown. But it was
clearly there. Regarding app.config - unfortunately azure functions does
not support redirects. And this was on their beta runtime which is dotnet
core.

Am 30.01.2018 08:43 schrieb "Kevin Ransom (msft)" <[email protected]

:

Could it not find the FSharp.Core.dll or was there a manifest error or
signing error?
What was the .exe?
Was it coreclr or desktop, if desktop what was the app.config?

From: Steffen Forkmann [mailto:[email protected]]
Sent: Monday, January 29, 2018 11:40 PM
To: Microsoft/visualfsharp visualfsharp@noreply.github.com
Cc: Kevin Ransom Kevin.Ransom@microsoft.com; Assign <
[email protected]>
Subject: Re: [Microsoft/visualfsharp] [Updated] Strong name validation
failure on FSharp.Core 4.4.3.0 results in .NET Framework/.NET Standard
unable to run on 15.6 Preview 3 (#4263)

It could not find the dll while I was pretty sure it was alongside. Paket
downgrade of fsharp.core fixed it immediately.

Am 30.01.2018 08:38 schrieb "Kevin Ransom (msft)" <
[email protected]
>:

@forki https://github.com/forki, What were the issues?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
issuecomment-361502127>,
or mute the thread
WFidJcy34S939pWNKuUks5tPsbwgaJpZM4RsbRC>
.

—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub protection.outlook.com/?url=https%3A%2F%2Fgithub.com%
2FMicrosoft%2Fvisualfsharp%2Fissues%2F4263%23issuecomment-361502448&data=
02%7C01%7CKevin.Ransom%40microsoft.com%7C8615a6e830084c2db13e08d567b4b4a8%
7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C0%7C636528948174284501&sdata=
NrfmtQd85qALu4lZm01Un5CXxp%2Bg%2Fn%2FVetcdq8FwWzE%3D&reserved=0>, or mute
the thread https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-
auth%2FAE76FojeNnsj6ZW2_XEoZNVFCaxVkLVJks5tPsdfgaJpZM4
RsbRC&data=02%7C01%7CKevin.Ransom%40microsoft.com%
7C8615a6e830084c2db13e08d567b4b4a8%7Cee3303d7fb734b0c8589bcd847f1
c277%7C1%7C0%7C636528948174284501&sdata=3EXOFWK7ZKFxABPqLO9c98LKIDIe0W
luBzJVa%2F3OEaM%3D&reserved=0>.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/visualfsharp/issues/4263#issuecomment-361502965,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNGg8MyS1gqLkSJvn_Fk-lJfIHb9Zks5tPsgHgaJpZM4RsbRC
.

Could you try again and capture the output.

no I'm rather not changing it before the big presentation next week. After that I can do it - but there were no interesting details shown.

sounds good.

Could not load file or assembly 'FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). Could not load file or assembly 'FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

even in the azure functions logs there is nothing more to see.

@cartermp, @forki.

Can someone give me straightforward repro steps to see this error. Or better yet an oss repro that demonstrates this error.

My intuition is that this is a publish error with the app having a dependence on the 4.4.1.0 dll, and a component dependent on the 4.4.3.0 dll. I think I will need to look at the moving parts to see how the error is introduced.

Kevin

No I can't. I was only able to reproduce on Microsoft azure functions. But
it did repro there every single try with many different azure functions. I
needed to revert them all.

Am 31.01.2018 20:22 schrieb "Kevin Ransom (msft)" <[email protected]

:

@cartermp https://github.com/cartermp, @forki https://github.com/forki
.

Can someone give me straightforward repro steps to see this error. Or
better yet an oss repro that demonstrates this error.

My intuition is that this is a publish error with the app having a
dependence on the 4.4.1.0 dll, and a component dependent on the 4.4.3.0
dll. I think I will need to look at the moving parts to see how the error
is introduced.

Kevin

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/visualfsharp/issues/4263#issuecomment-362041541,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADgNC41M2O5n8rZSJB7ItYINoGivT__ks5tQL18gaJpZM4RsbRC
.

@KevinRansom Does the repro link at the top not do this for you? The repro steps are to run ctrl-f5 on that project with 15.6 Preview 3.

Argh, I'm stupid. I uploaded the wrong solution that repros this on my machine. I'll do that when I get home.

Thanks ... and probably not stupid, just a small error.

Updated here:
ConsoleApplication18.zip

Okay, I know what is going on here.

The solution was created with an earlier version of VS and so the console app targets FSharp.Core: 4.4.1.0
<snip> <TargetFSharpCoreVersion>4.4.1.0</TargetFSharpCoreVersion> </snip>

The netsdk project targets the latest version of fsharp.core.dll, from FSharp.Core nuget package 4.3.

The AutoGenerate binding redirects, for the console application says .... Hmmm!!!! you picked FSharp.Core.dll, v 4.4.1.0 and yet your dependency needs 4.4.3.0, I'm going to pick 4.4.1.0 and warn you. Which it does:
2>C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2058,5): warning MSB3277: Found conflicts between different versions of "FSharp.Core" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.

The issue arises because legacy windows projects always picks a specific version of FSharp.Core and dotnet sdk, floats using nuget.

There are two choices to solve this:

  1. Edit desktop project to have the line:
    <snip> <TargetFSharpCoreVersion>4.4.3.0</TargetFSharpCoreVersion> </snip>
    or edit the netsdk project to have the line:
    ````

    netstandard2.0
    4.2.*

````
I hope this helps:

I don't think it's what my issue is. Paket always pins versions - so nuget can't float.

If you have a repro that I could examine, or maybe zip up the deployed files, I can examine your failure.

I wonder how to proceed. it only happens on azure functions for me.

@forki I think you might have to report a bug on Azure Functions

Yeah. But all these reports were going to dev/null in the past. Sorry I have zero confidence in that process.

@forki this is the v2 runtime, yes?

Yes it's beta runtime.

@forki If you try to load a dll that is already included in azure functions runtime, but at a different version, the runtime will prevent that dll from being loaded. (Which is a well known source of pain Azure/azure-functions-host#992)

Since the V2 runtime comes with FSharp.Core.dll version 4.4.1.0, it will prevent loading FSharp.Core.dll at version 4.4.3.0 and fail with such criptic message.

If you pin FSharp.Core to 4.1.18, then it should work.

I'm well aware of that issue, but I didn't assume they bundle a fsharp.core. That's weird. Also I'm currently using fsharp.core nuget package 4.2.3 which works. But upgrade does not.

Closing as this is an Azure Functions issue and not the same (urgent) issue tracked originally. If there's a remaining F# issue here please open a new issue

Actually the repro project in the OP is not Azure Functions, but I think we can consider this issue out of date now that we have shipped an updated FSharp.Core binary in VS

Was this page helpful?
0 / 5 - 0 ratings