I think its always best to check the basics first, is the assembly referenced and do you have the namespace open. One your passed that look at the were the type you want use is defined using reflector and create a very simple test and check it compiles. Once you have this does intellisense start working.

Cheers,
Rob

By on 9/13/2008 10:50 AM ()

The odd thing is, I can see portion of the System.Security.Cryptography in f#(aes, rsa etc.) but not the new CNG and EC*(they are all under the same namespace). I add the same System and System.Core assembly to both c# and f# projects.

By on 9/14/2008 9:33 AM ()

Hi, gary--

I can only reiterate what you've already pointed out: 1), that the new algorithms reside in the System.Security.Cryptography namespace; and 2), that a reference to System.Core.dll should be all that's required.

I created a new F# solution (you get a reference to System.Core.dll by default) and added the following code to my source file:

1
2
3
4
#light


type cng = System.Security.Cryptography.CngAlgorithm

It compiled just fine. Since you've verified that you have a reference to System.Core, you may just be seeing an issue with Intellisense. I've found that you can't always rely on it and there are times when I will ignore Intellisense and run a build regardless of what it says. The compiler will tell you if you really have errors in your code.

Also, which version of F# are you using? Can you post some of the code that isn't compiling?

By on 9/15/2008 5:57 AM ()

thanks for the help.

What is strange is that If I edit a .fs file, intellisense works(I can see the CNG stuff) and compiles fine, but not in fsx which I used as I wanted to test f# in an interactive manner.

And sending the following to F# interactive also fails(same code in .fs compiles fine)

1
2
3
4
5
6
7
#light

open System
open System.Security.Cryptography

let cng = System.Security.Cryptography.CngKey.Create(CngAlgorithm.ECDsaP256,"abc")
By on 9/15/2008 8:04 AM ()

F# Interactive does not reference System.Core by default. Your example should work just fine if you add a reference to it like this:

1
2
3
4
5
6
7
8
9
#light
#r "System.Core"


open System
open System.Security.Cryptography


let cng = System.Security.Cryptography.CngKey.Create(CngAlgorithm.ECDsaP256,"abc")

Hope that helps!

By on 9/15/2008 8:19 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper