2010-12-30 9 views
0

私はVS2010で次のコードを試してみた:F#インタラクティブなバグ?

open System.Security.Cryptography 

let rsaTest1 = 
    let ecKey = [|0uy..143uy|] // junk data for testing 

    let ecKeyMod = ecKey.[8..8+128-1] 
    let ecKeyExp = ecKey.[136..136+8-1] 
    let rsa = RSAParameters(Modulus = ecKeyMod, Exponent = ecKeyExp) 

    rsa 


let rsaTest2 = 
    let ecKey = [|0uy..143uy|] // junk data for testing 

    let rsa = RSAParameters(Modulus = ecKey.[8..8+128-1], Exponent = ecKey.[136..136+8-1]) 

    rsa 

私はすべてのコードをハイライト表示し、F#インタラクティブ(Altキー+ Enterキー)に送信した場合、その後、rsaTest1は動作しますが、rsaTest2は、エラーメッセージを表示します、

System.NullReferenceException: Object reference not set to an instance of an object. 
    at <StartupCode$FSI_0004>[email protected]() in P:\proj\Tachograph\Project\CompuTachTest\CompuTachTest\rsaTest.fsx:line 16 

私は関数に値からrsaTest2を変更し、それを呼び出す、

let rsaTest2() = 
    let ecKey = [|0uy..143uy|] // junk data for testing 
    let rsa = RSAParameters(Modulus = ecKey.[8..8+128-1], Exponent = ecKey.[136..136+8-1]) 
    rsa 

let x = rsaTest2() 

場合しかし、その後、エラーがありません。 F#バグか私の間違い?

答えて

5

これが最も可能性の高いバグです - あなたはFSCで掲示スニペットをコンパイルし、それを実行した場合、あなたは、x64のためにこれを取得する:

x86用
Unhandled Exception: System.InvalidProgramException: Common Language Runtime detected an invalid program. 
at <StartupCode$test>[email protected]() 

と、これを:

Unhandled Exception: System.InvalidProgramException: JIT Compiler encountered an internal limitation. 
at <StartupCode$test>[email protected]() 

あなたがすべきMicrosoft Connect経由で報告してください。

+0

私は何が起こったかについてコメントするのを忘れましたが、ここに行きます:私はバグをMSに報告し、Don Symeはそれを確認しました。 –