public void ExceptionInReadAllBytes() { var ex = new Exception("Crazy exception you could never have predicted!"); var provider = new TestDesktopStrongNameProvider((_) => { throw ex; }); var src = @"class C {}"; var keyFile = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey).Path; var options = TestOptions.DebugDll .WithStrongNameProvider(provider) .WithCryptoKeyFile(keyFile); var comp = CreateCompilationWithMscorlib(src, options: options); comp.VerifyEmitDiagnostics( // error CS7027: Error signing output with public key from file '{0}' -- '{1}' Diagnostic(ErrorCode.ERR_PublicKeyFileFailure).WithArguments(keyFile, ex.Message).WithLocation(1, 1)); }
public void ExceptionInReadKeysFromContainer() { var ex = new Exception("Crazy exception you could never have predicted!"); var provider = new TestDesktopStrongNameProvider(readKeysFromContainer: (string _1, out ImmutableArray <byte> _2) => { throw ex; }); var src = @"class C {}"; var options = TestOptions.DebugDll .WithStrongNameProvider(provider) .WithCryptoKeyContainer("RoslynTestContainer"); var comp = CreateCompilationWithMscorlib(src, options: options); comp.VerifyEmitDiagnostics( // error CS7028: Error signing output with public key from container 'RoslynTestContainer' -- Crazy exception you could never have predicted! Diagnostic(ErrorCode.ERR_PublicKeyContainerFailure).WithArguments("RoslynTestContainer", ex.Message).WithLocation(1, 1)); }
public void ExceptionInReadAllBytes() { var ex = new Exception("Crazy exception you could never have predicted!"); var provider = new TestDesktopStrongNameProvider((_) => { throw ex; }); var src = @"class C {}"; var keyFile = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey).Path; var options = TestOptions.DebugDll .WithStrongNameProvider(provider) .WithCryptoKeyFile(keyFile); var comp = CreateCompilationWithMscorlib(src, options: options); comp.VerifyEmitDiagnostics( // error CS7027: Error signing output with public key from file '{0}' -- '{1}' Diagnostic(ErrorCode.ERR_PublicKeyFileFailure).WithArguments(keyFile, ex.Message).WithLocation(1, 1)); }
public void ExceptionInReadKeysFromContainer() { var ex = new Exception("Crazy exception you could never have predicted!"); var provider = new TestDesktopStrongNameProvider(readKeysFromContainer: (string _1, out ImmutableArray<byte> _2) => { throw ex; }); var src = @"class C {}"; var options = TestOptions.DebugDll .WithStrongNameProvider(provider) .WithCryptoKeyContainer("RoslynTestContainer"); var comp = CreateCompilationWithMscorlib(src, options: options); comp.VerifyEmitDiagnostics( // error CS7028: Error signing output with public key from container 'RoslynTestContainer' -- Crazy exception you could never have predicted! Diagnostic(ErrorCode.ERR_PublicKeyContainerFailure).WithArguments("RoslynTestContainer", ex.Message).WithLocation(1, 1)); }