135 references to WithAllowUnsafe
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
47return project.Solution.WithProjectCompilationOptions(project.Id, compilationOptions.WithAllowUnsafe(true));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (26)
CodeGen\CodeGenConversionTests.cs (1)
1070var compilation = CreateCompilationWithMscorlib45AndCSharp(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true));
CodeGen\CodeGenDynamicTests.cs (2)
41var unoptimizedCompilation = CreateCompilationWithMscorlib45(source, references, parseOptions: parseOptions, options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All).WithAllowUnsafe(allowUnsafe)); 42var optimizedCompilation = CreateCompilationWithMscorlib45(source, references, parseOptions: parseOptions, options: TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All).WithAllowUnsafe(allowUnsafe));
CodeGen\CodeGenLocalFunctionTests.cs (5)
4609VerifyOutput(source, output, TestOptions.ReleaseExe.WithAllowUnsafe(true).WithWarningLevel(0), verify: Verification.Passes); 4635VerifyOutput(source, "2", TestOptions.ReleaseExe.WithAllowUnsafe(true), verify: Verification.Fails); 4661VerifyOutput(source, "2", TestOptions.ReleaseExe.WithAllowUnsafe(true), verify: Verification.Fails); 4688VerifyOutput(source, "2", TestOptions.ReleaseExe.WithAllowUnsafe(true), verify: Verification.Fails); 4728VerifyOutput(src, $"10{Environment.NewLine}4", TestOptions.ReleaseExe.WithAllowUnsafe(true), verify: Verification.Fails);
CodeGen\CodeGenShortCircuitOperatorTests.cs (4)
5194var verifier = CompileAndVerify(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), verify: Verification.Fails, expectedOutput: @"--- 5245var verifier = CompileAndVerify(source, verify: Verification.FailsILVerify, options: TestOptions.DebugExe.WithAllowUnsafe(true), expectedOutput: @"--- 5556var verifier = CompileAndVerify(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), verify: Verification.Fails, expectedOutput: @"--- 5629var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true));
CodeGen\CodeGenTests.cs (1)
17176var compilation = CompileAndVerify(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true), verify: Verification.Skipped, expectedOutput: @"");
CodeGen\CodeGenTupleTest.cs (3)
14213options: TestOptions.ReleaseExe.WithAllowUnsafe(true), 14403options: TestOptions.ReleaseExe.WithAllowUnsafe(true)); 27374var comp1 = CreateCompilation(source0, options: TestOptions.DebugExe.WithAllowUnsafe(true));
CodeGen\ObjectAndCollectionInitializerTests.cs (2)
3360CompileAndVerify(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), expectedOutput: "1", verify: Verification.Fails); 3402CompileAndVerify(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), verify: Verification.Fails, expectedOutput:
CodeGen\WinMdDelegateTests.cs (1)
145options: TestOptions.ReleaseWinMD.WithAllowUnsafe(true),
Emit\CompilationEmitTests.cs (1)
1893options: TestOptions.DebugDll.WithAllowUnsafe(true));
Emit\DeterministicTests.cs (1)
479.WithAllowUnsafe(true)
Emit\EditAndContinue\EditAndContinueTests.cs (4)
1386var compilation0 = CreateCompilation(source0.Tree, options: ComSafeDebugDll.WithAllowUnsafe(true).WithMetadataImportOptions(MetadataImportOptions.All)); 1474var compilation0 = CreateCompilation(source0.Tree, options: ComSafeDebugDll.WithAllowUnsafe(true).WithMetadataImportOptions(MetadataImportOptions.All)); 1532var compilation0 = CreateCompilation(source0.Tree, options: ComSafeDebugDll.WithAllowUnsafe(true).WithMetadataImportOptions(MetadataImportOptions.All)); 1616var compilation0 = CreateCompilation(source0.Tree, options: ComSafeDebugDll.WithAllowUnsafe(true).WithMetadataImportOptions(MetadataImportOptions.All));
Emit\EditAndContinue\LocalSlotMappingTests.cs (1)
4929var compilation0 = CreateCompilation(source0.Tree, options: ComSafeDebugDll.WithAllowUnsafe(true));
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (27)
Attributes\AttributeTests_WellKnownAttributes.cs (3)
12577var comp = CompileAndVerify(source, options: TestOptions.DebugModule.WithAllowUnsafe(true), verify: Verification.Fails); 12607var metadata_comp = CreateCompilation(metadata_source, options: TestOptions.DebugModule.WithAllowUnsafe(true)); 12728var comp = CreateCompilation(source, options: TestOptions.DebugDll.WithAllowUnsafe(true));
Emit\NumericIntPtrTests.cs (2)
5969var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithAllowUnsafe(useUnsafeContext), parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net70); 8087var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithAllowUnsafe(useUnsafeContext), parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.Net70);
Semantics\PatternMatchingTests.cs (4)
2574var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 3475options: TestOptions.ReleaseDebugDll.WithAllowUnsafe(true), 6157var compilation = CreateCompilation(program, options: TestOptions.DebugDll.WithAllowUnsafe(true)); 6222var compilation = CreateCompilation(program, options: TestOptions.DebugExe.WithAllowUnsafe(true));
Semantics\PatternMatchingTests_Scope.cs (7)
9764var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 9908var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 13136var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 13296var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 13461var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 13690var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 13728var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular);
Semantics\PatternMatchingTests3.cs (6)
385var compilation = CreatePatternCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 1229CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular7_3).VerifyDiagnostics( 1243CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular8).VerifyDiagnostics(); 3488var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 5253var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9)); 5322var compilation = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9));
Semantics\PatternMatchingTests4.cs (5)
3357var compilation = CreatePatternCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 3384var compilation = CreatePatternCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 3410var compilation = CreatePatternCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true)); 3431var compilation = CreatePatternCompilation(source, options: TestOptions.DebugDll.WithAllowUnsafe(true)); 3466var compilation = CreatePatternCompilation(source, options: TestOptions.DebugDll.WithAllowUnsafe(true));
Microsoft.CodeAnalysis.CSharp.Features (1)
CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
47return project.Solution.WithProjectCompilationOptions(project.Id, compilationOptions.WithAllowUnsafe(true));
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (4)
IOperation\IOperationTests_IForEachLoopStatement.cs (4)
3127VerifyFlowGraphAndDiagnosticsForTest<BlockSyntax>(source + SpanSource, expectedFlowGraph, expectedDiagnostics, TestOptions.ReleaseDll.WithAllowUnsafe(true)); 3216VerifyFlowGraphAndDiagnosticsForTest<BlockSyntax>(source + SpanSource, expectedFlowGraph, expectedDiagnostics, TestOptions.ReleaseDll.WithAllowUnsafe(true)); 3305VerifyFlowGraphAndDiagnosticsForTest<BlockSyntax>(source + SpanSource, expectedFlowGraph, expectedDiagnostics, TestOptions.ReleaseDll.WithAllowUnsafe(true)); 3394VerifyFlowGraphAndDiagnosticsForTest<BlockSyntax>(source + SpanSource, expectedFlowGraph, expectedDiagnostics, TestOptions.ReleaseDll.WithAllowUnsafe(true));
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (47)
Semantics\BetterCandidates.cs (4)
947CreateCompilationWithoutBetterCandidates(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics( 952var compilation = CreateCompilationWithBetterCandidates(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics( 1006CreateCompilationWithoutBetterCandidates(source2, references: new[] { reference1 }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics( 1014CreateCompilationWithBetterCandidates(source2, references: new[] { reference1 }, options: TestOptions.ReleaseExe.WithAllowUnsafe(true)).VerifyDiagnostics(
Semantics\DynamicTests.cs (3)
3606var verifier = CompileAndVerify(source, options: TestOptions.DebugDll.WithAllowUnsafe(true), verify: Verification.FailsPEVerify).VerifyDiagnostics(); 3634var verifier = CompileAndVerify(source, options: TestOptions.DebugDll.WithAllowUnsafe(true), verify: Verification.FailsPEVerify).VerifyDiagnostics(); 3661CreateCompilation(source, options: TestOptions.DebugDll.WithAllowUnsafe(true)).VerifyDiagnostics(
Semantics\ImplicitObjectCreationTests.cs (1)
3011var comp = CreateCompilation(source, options: TestOptions.DebugExe.WithAllowUnsafe(true));
Semantics\LocalFunctionTests.cs (1)
3123var comp = CreateCompilation(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(true));
Semantics\NativeIntegerTests.cs (2)
9464var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithAllowUnsafe(useUnsafeContext), parseOptions: TestOptions.Regular9); 12350var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithAllowUnsafe(useUnsafeContext), parseOptions: TestOptions.Regular9);
Semantics\OperatorTests.cs (1)
11453CreateCompilation(source, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics(
Semantics\OutVarTests.cs (11)
5875var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 6025var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 6108var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 6142var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 19715options: TestOptions.ReleaseExe.WithAllowUnsafe(true), 20813options: TestOptions.ReleaseDebugDll.WithAllowUnsafe(true), 22323var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 22489var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 22700var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 22939var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular); 22977var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe.WithAllowUnsafe(true), parseOptions: TestOptions.Regular);
Semantics\StackAllocInitializerTests.cs (7)
1519CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 1548CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 1577CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 1632CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 1669CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 1700CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular7_3).VerifyDiagnostics( 1711CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular8).VerifyDiagnostics(
Semantics\StackAllocSpanExpressionsTests.cs (9)
432CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 453CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 490CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 512CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular7_3).VerifyDiagnostics( 517CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 540CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular7_3).VerifyDiagnostics( 545CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular8).VerifyDiagnostics( 561CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular7_3).VerifyDiagnostics( 566CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), parseOptions: TestOptions.Regular8).VerifyDiagnostics(
Semantics\TargetTypedConditionalOperatorTests.cs (3)
333var comp = CreateCompilation(tree, options: TestOptions.DebugDll.WithAllowUnsafe(true)); 432CreateCompilation(source, parseOptions: TestOptions.Regular8, options: TestOptions.DebugDll.WithAllowUnsafe(true)) 434CreateCompilation(source, parseOptions: TestOptions.Regular.WithLanguageVersion(MessageID.IDS_FeatureTargetTypedConditional.RequiredVersion()), options: TestOptions.DebugDll.WithAllowUnsafe(true))
Semantics\TargetTypedDefaultTests.cs (1)
2203var comp = CreateCompilation(source, parseOptions: TestOptions.Regular7_1, options: TestOptions.DebugExe.WithAllowUnsafe(true));
Semantics\UnsafeTests.cs (4)
186CreateCompilation(text, options: TestOptions.UnsafeReleaseDll.WithAllowUnsafe(false)).VerifyDiagnostics( 205CreateCompilation(text, options: TestOptions.UnsafeReleaseDll.WithAllowUnsafe(false)).VerifyDiagnostics( 239compilationOptions: TestOptions.UnsafeReleaseDll.WithAllowUnsafe(false), 1041CreateCompilation(text, options: TestOptions.UnsafeReleaseDll.WithAllowUnsafe(false)).VerifyDiagnostics(
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (14)
Compilation\CompilationAPITests.cs (1)
1993c2 = c1.WithOptions(TestOptions.DebugModule.WithAllowUnsafe(true));
Compilation\CSharpCompilationOptionsTests.cs (1)
116TestProperty((old, value) => old.WithAllowUnsafe(value), opt => opt.AllowUnsafe, true);
Symbols\Source\NullablePublicAPITests.cs (1)
2209var comp = CreateCompilation(source, options: WithNullableEnable().WithAllowUnsafe(true));
Symbols\StaticAbstractMembersInInterfacesTests.cs (10)
15306var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), 15371var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), 15393compilation1 = CreateCompilation(source1, options: TestOptions.ReleaseDll.WithAllowUnsafe(true), 15450var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll.WithAllowUnsafe(true), 15461var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), 15499var compilation2 = CreateCompilation(source2, options: TestOptions.DebugDll.WithAllowUnsafe(true), 15510var compilation3 = CreateCompilation(source2 + source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), 22066var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), 22216var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true), 29878var compilation1 = CreateCompilation(source1, options: TestOptions.DebugDll.WithAllowUnsafe(true),
Symbols\SymbolErrorTests.cs (1)
3143var c = CreateCompilation(text, options: TestOptions.ReleaseDll.WithAllowUnsafe(false));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (3)
Parsing\ParserErrorMessageTests.cs (2)
4920CreateCompilationWithMscorlibAndSpan(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics( 4941CreateCompilation(test, options: TestOptions.ReleaseDll.WithAllowUnsafe(true)).VerifyDiagnostics(
Parsing\ReadOnlyStructs.cs (1)
149var comp = CreateCompilationWithMscorlib45(text, parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.Latest), options: TestOptions.DebugDll.WithAllowUnsafe(true));
Microsoft.CodeAnalysis.CSharp.Test.Utilities (5)
CSharpTestBase.cs (1)
1454var comp = CreateCompilation(source, options: TestOptions.ReleaseExe.WithAllowUnsafe(allowUnsafe));
TestOptions.cs (4)
87public static readonly CSharpCompilationOptions UnsafeReleaseDll = ReleaseDll.WithAllowUnsafe(true); 88public static readonly CSharpCompilationOptions UnsafeReleaseExe = ReleaseExe.WithAllowUnsafe(true); 90public static readonly CSharpCompilationOptions UnsafeDebugDll = DebugDll.WithAllowUnsafe(true); 91public static readonly CSharpCompilationOptions UnsafeDebugExe = DebugExe.WithAllowUnsafe(true);
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (2)
Metadata\WinMdEventTests.cs (2)
241options: TestOptions.DebugWinMD.WithAllowUnsafe(true), 313options: TestOptions.DebugModule.WithAllowUnsafe(true));
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Workspaces\TestWorkspace_XmlConsumption.cs (1)
692compilationOptions = ((CSharpCompilationOptions)compilationOptions).WithAllowUnsafe(allowUnsafe).WithNullableContextOptions(nullable);
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
CSharpDeterministicKeyBuilderTests.cs (1)
285.WithAllowUnsafe(@unsafe)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (1)
SymbolsTests\Metadata\PE\HasUnsupportedMetadata.vb (1)
517compilationOptions:=New CSharp.CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithAllowUnsafe(True))
Microsoft.VisualStudio.LanguageServices.CSharp (2)
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
139return ((CSharpCompilationOptions)compilationOptions).WithAllowUnsafe(GetBooleanOption(CompilerOptions.OPTID_UNSAFE))
Utilities\CSharpCompilationOptionsChangingService.cs (1)
30return oldCSharpOptions.WithAllowUnsafe(newCSharpOptions.AllowUnsafe).WithNullableContextOptions(newCSharpOptions.NullableContextOptions) == newOptions;