public void BadInputStream() { string src = @" class C { public static void Main(string[] args) { } }"; var testProvider = new StrongNameProviderWithBadInputStream(s_defaultDesktopProvider); var options = TestOptions.DebugExe .WithStrongNameProvider(testProvider) .WithCryptoKeyContainer("RoslynTestContainer"); var comp = CreateCompilation(src, options: options); comp.Emit(new MemoryStream()).Diagnostics.Verify( // error CS8104: An error occurred while writing the Portable Executable file. Diagnostic(ErrorCode.ERR_PeWritingFailure).WithArguments(testProvider.ThrownException.ToString()).WithLocation(1, 1)); }
public void BadInputStream() { string src = @" class C { public static void Main(string[] args) { } }"; var testProvider = new StrongNameProviderWithBadInputStream(s_defaultProvider); var options = TestOptions.DebugExe .WithStrongNameProvider(testProvider) .WithCryptoKeyContainer("RoslynTestContainer"); var comp = CreateCompilationWithMscorlib(src, options: options); comp.VerifyEmitDiagnostics( // error CS7028: Error signing output with public key from container 'RoslynTestContainer' -- This is a test IOException Diagnostic(ErrorCode.ERR_PublicKeyContainerFailure).WithArguments("RoslynTestContainer", "This is a test IOException").WithLocation(1, 1)); }
public void BadInputStream() { string src = @" class C { public static void Main(string[] args) { } }"; var testProvider = new StrongNameProviderWithBadInputStream(s_defaultProvider); var options = TestOptions.DebugExe .WithStrongNameProvider(testProvider) .WithCryptoKeyContainer("RoslynTestContainer"); var comp = CreateCompilationWithMscorlib(src, options: options); comp.Emit(new MemoryStream()).Diagnostics.Verify( // error CS8104: An error occurred while writing the Portable Executable file. Diagnostic(ErrorCode.ERR_PeWritingFailure).WithArguments(testProvider.ThrownException.ToString()).WithLocation(1, 1)); }