FSI netcore not seeing System.Security.Cryptography asm
See original GitHub issueIn VS Version 17.4.0 Preview 2.1 editing a fsx file with “Use .NET Core Scripting” enabled:
Not showing any types from System.Security.Cryptography asm, (Aes
, AesCcm
, AesCng
, …)
In FSI (F# Interactive version 12.0.5.0 for F# 7.0):
$ dotnet fsi
Microsoft (R) F# Interactive version 12.0.5.0 for F# 7.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> System.Security.Cryptography.MD5.Create();;
System.Security.Cryptography.MD5.Create();;
-----------------------------^^^
stdin(12,30): error FS0039: The value, constructor, namespace or type 'MD5' is not defined.
Yet reflection works fine:
> type ComputeHash = delegate of byte[] -> byte[]
let computeHash =
let asm = System.AppDomain.CurrentDomain.GetAssemblies() |> Seq.find (fun x -> x.FullName.StartsWith("System.Security.Cryptography,"))
let md5 = asm.GetTypes() |> Seq.find (fun x -> x.Name = "MD5")
let computeHashMeth = md5.GetMethod("ComputeHash", [| typeof<byte[]> |])
let md5obj = md5.GetMethod("Create",[||]).Invoke(null,[||])
let d : ComputeHash = computeHashMeth.CreateDelegate(md5obj)
fun x -> d.Invoke x
;;
type ComputeHash =
delegate of byte[] -> byte[]
val computeHash: (byte[] -> byte[])
> computeHash [|0uy|];;
val it: byte[] =
[|147uy; 184uy; 133uy; 173uy; 254uy; 13uy; 160uy; 137uy; 205uy; 246uy; 52uy;
144uy; 79uy; 213uy; 159uy; 113uy|]
A F# net7.0 project works fine
Compiles and runs.
FSI without “Use .NET Core Scripting” works fine.
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:7
Top Results From Across the Web
Scripts breaking after upgrade to .NET 7 due to missing ...
Describe the bug Both fsharp & csharp scripts fail to see any class from System.Security.Cryptography on .NET 7 To Reproduce Running this ...
Read more >Announcing F# 7 - .NET Blog
The F# compiler is improved to offer reference assemblies, trimmability, better code gen, ARM64 support, performance enhancements and bug fixes.
Read more >c# - Could not load file or assembly 'System.Security. ...
So your library references System.Security.Cryptography.Algorithms 4.3.0 however the actual version of the assembly to load for your ...
Read more >Untitled
Cryptography Namespace Microsoft Learn Web5 thg 10, 2022 · FSI netcore not seeing System.Security.Cryptography asm · Issue #14024 · dotnet/fsharp · GitHub.
Read more >Implementing Web Services Security - MyF5
To use web services security for encryption, decryption, and digital signature signing and verification, you must upload client and server certificates onto ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
work around:
#r "System.Security.Cryptography"
in top of fsxWe have the same problem.