88 references to AsSourceGenerator
IdeCoreBenchmarks (1)
IncrementalSourceGeneratorBenchmarks.cs (1)
129})).AsSourceGenerator();
Microsoft.Analyzers.Extra.Tests (1)
Resources\RoslynTestUtils.cs (1)
223CSharpGeneratorDriver cgd = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: options);
Microsoft.Analyzers.Local.Tests (1)
Resources\RoslynTestUtils.cs (1)
223CSharpGeneratorDriver cgd = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: options);
Microsoft.AspNetCore.Http.Extensions.Tests (9)
RequestDelegateGenerator\CompileTimeCreationTests.cs (8)
60var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator(); 86var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator(); 168var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator(); 235var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator(); 289var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator(); 336var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator(); 672var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator(); 729var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator();
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
57var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator();
Microsoft.AspNetCore.Http.Microbenchmarks (2)
RequestDelegateGeneratorBenchmarks.cs (1)
35var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator();
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
57var generator = new RequestDelegateGenerator.RequestDelegateGenerator().AsSourceGenerator();
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
SnapshotTestHelper.cs (1)
92generators: [generator.AsSourceGenerator()],
Microsoft.CodeAnalysis.CSharp (1)
SourceGeneration\CSharpGeneratorDriver.cs (1)
51=> Create(incrementalGenerators.Select(GeneratorExtensions.AsSourceGenerator), additionalTexts: null);
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (14)
CommandLineTests.cs (14)
9435generators: new[] { new DoNothingGenerator().AsSourceGenerator() }); 10121void RunWithNoCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview" }, generators: new[] { generator.AsSourceGenerator() }, analyzers: null); 10123void RunWithCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache" }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10180void RunWithCache(string outputPath) => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/out:" + outputPath, "/features:enable-generator-cache" }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10246void RunWithCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache" }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10248void RunWithCacheDisabled() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview" }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10305void RunWithOneGenerator() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache" }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10307void RunWithTwoGenerators() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache" }, generators: new[] { generator.AsSourceGenerator(), generator2.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10353void RunWithCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache", "/additionalFile:" + additionalFile.Path }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10450void RunWithCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache", "/analyzerConfig:" + editorconfig.Path, "/analyzerConfig:" + globalconfig.Path }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10487void RunWithCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache" }, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null); 10518VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview" }, generators: new[] { generator.AsSourceGenerator() }, analyzers: null); 15453generators: new[] { generator.AsSourceGenerator() });
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (47)
SourceGeneration\GeneratorDriverTests.cs (44)
508GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: parseOptions); 1507GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: parseOptions); 1547GeneratorDriver driver = CSharpGeneratorDriver.Create([generator.AsSourceGenerator()], parseOptions: parseOptions); 3222generators: [generator.AsSourceGenerator()], 3289GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: parseOptions, additionalTexts: new[] { new InMemoryAdditionalText("text.txt", "") }, driverOptions: TestOptions.GeneratorDriverOptions); 3336GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator1.AsSourceGenerator(), generator2.AsSourceGenerator() }, parseOptions: parseOptions, additionalTexts: new[] { additionalText }, driverOptions: TestOptions.GeneratorDriverOptions); 3423GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: parseOptions, additionalTexts: new[] { new InMemoryAdditionalText("text.txt", "") }, driverOptions: TestOptions.GeneratorDriverOptions); 3449GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, 3489GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, 3523}).AsSourceGenerator(); 3552}).AsSourceGenerator(); 3583}).AsSourceGenerator(); 3592}).AsSourceGenerator(); 3631}).AsSourceGenerator(); 3674}).AsSourceGenerator(); 3702}).AsSourceGenerator(); 3758}).AsSourceGenerator(); 3792}).AsSourceGenerator(); 3884}).AsSourceGenerator(); 3917}).AsSourceGenerator(); 4008}).AsSourceGenerator(); 4381var sourceGenerator = incrementalGenerator.AsSourceGenerator(); 4402var sourceGenerator = generator.AsSourceGenerator(); 4413var sourceGenerator = generator.AsSourceGenerator(); 4436var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator1"); }); }).AsSourceGenerator(); 4437var generator2 = new PipelineCallbackGenerator2((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator2"); }); }).AsSourceGenerator(); 4481var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", "//" + c.SyntaxTrees.First().GetRoot().ToFullString() + " generator1"); }); }).AsSourceGenerator(); 4482var generator2 = new PipelineCallbackGenerator2((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", "//" + c.SyntaxTrees.First().GetRoot().ToFullString() + " generator2"); }); }).AsSourceGenerator(); 4505var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen1Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator1"); }); }).AsSourceGenerator(); 4506var generator2 = new PipelineCallbackGenerator2((ctx) => { initWasCalled = true; ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { spc.AddSource("gen2Source.cs", c.SyntaxTrees.First().GetRoot().ToFullString() + " //generator2"); }); }).AsSourceGenerator(); 4534var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterSourceOutput(ctx.CompilationProvider, (spc, c) => { stepRan = true; }); }).AsSourceGenerator(); 4590var generator = new PipelineCallbackGenerator((ctx) => { ctx.RegisterPostInitializationOutput(postInitCtx => { postInitCtx.AddSource("staticSource.cs", "//static"); }); }).AsSourceGenerator(); 4610var generator1 = new PipelineCallbackGenerator((ctx) => { ctx.RegisterPostInitializationOutput(postInitCtx => { postInitCtx.AddSource("staticSource.cs", "//static"); }); }).AsSourceGenerator(); 4611var generator2 = new PipelineCallbackGenerator2((ctx) => { ctx.RegisterPostInitializationOutput(postInitCtx => { postInitCtx.AddSource("staticSource2.cs", "//static 2"); }); }).AsSourceGenerator(); 4651GeneratorDriver driver = CSharpGeneratorDriver.Create([generator.AsSourceGenerator()], parseOptions: parseOptions); 4669[generator.AsSourceGenerator()], 4686GeneratorDriver driver = CSharpGeneratorDriver.Create([generator.AsSourceGenerator()], parseOptions: parseOptions); 4706GeneratorDriver driver = CSharpGeneratorDriver.Create([generator.AsSourceGenerator()], parseOptions: parseOptions); 4724GeneratorDriver driver = CSharpGeneratorDriver.Create([generator1.AsSourceGenerator(), generator2.AsSourceGenerator()], parseOptions: parseOptions); 4742GeneratorDriver driver = CSharpGeneratorDriver.Create([generator1.AsSourceGenerator(), generator2.AsSourceGenerator()], parseOptions: parseOptions); 4759GeneratorDriver driver = CSharpGeneratorDriver.Create([generator.AsSourceGenerator()], parseOptions: parseOptions);
SourceGeneration\SyntaxAwareGeneratorTests.cs (3)
1191driver = driver.AddGenerators(ImmutableArray.Create(testGenerator2.AsSourceGenerator())); 2088}).AsSourceGenerator(); 2094}).AsSourceGenerator();
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
DeterministicKeyBuilderTests.cs (1)
807new Generator3().AsSourceGenerator());
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (2)
CommandLineTests.vb (2)
8946generators:={New DoNothingGenerator().AsSourceGenerator()}) 10701VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference:=False, generators:={generator.AsSourceGenerator()})
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (5)
SourceGeneration\GeneratorDriverTests.vb (5)
314End Sub).AsSourceGenerator() 346End Sub).AsSourceGenerator() 436End Sub).AsSourceGenerator() 467End Sub).AsSourceGenerator() 556End Sub).AsSourceGenerator()
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
TestGeneratorReference.cs (1)
39: this(generator.AsSourceGenerator(), analyzerFilePath)
Microsoft.Extensions.Validation.GeneratorTests (1)
ValidationsGeneratorTestBase.cs (1)
80var driver = CSharpGeneratorDriver.Create(generators: [generator.AsSourceGenerator()], parseOptions: ParseOptions);
System.Windows.Forms.PrivateSourceGenerators.Tests (1)
EnumValidationTests.cs (1)
305ISourceGenerator generator = new EnumValidationGenerator().AsSourceGenerator();