We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Steps to Reproduce:
c2ab239
SourceGeneratorTest.TestState.Sources depends on generated source code.
using System; using System.Collections.Generic; using System.Text; namespace Microsoft.CodeAnalysis.Testing.TestGenerators { public class AddSimpleAttribute : ISourceGenerator { public void Initialize(GeneratorInitializationContext context) { } public virtual void Execute(GeneratorExecutionContext context) { context.AddSource("SimpleAttribute", "using System;[AttributeUsage(AttributeTargets.All)] internal sealed class SimpleAttribute : Attribute { }"); } } }
await new CSharpSourceGeneratorTest<AddSimpleAttribute> { TestBehaviors = TestBehaviors.SkipGeneratedSourcesCheck, TestState = { Sources = { @"[Simple]class S {}", }, GeneratedSources = { (typeof(AddSimpleAttribute), "SimpleAttribute.cs", "using System;[AttributeUsage(AttributeTargets.All)] internal sealed class SimpleAttribute : Attribute { }"), }, }, }.RunAsync();
Expected Behavior:
Success
Actual Behavior:
System.InvalidOperationException : Context: Diagnostics of test state Mismatch between number of diagnostics returned, expected "0" actual "2"
Adding diagnostics to ExpectedDiagnostics will solve the problem, but it is different from the actual compilation result.
The text was updated successfully, but these errors were encountered:
This should have been fixed by #776. Can you try updating the library and check again?
Sorry, something went wrong.
Great! I want this behavior!
@naminodarie Note that this line completely disables validation for your source generator:
TestBehaviors = TestBehaviors.SkipGeneratedSourcesCheck,
You'll want to remove this line and just use the default behaviors.
@sharwell Thank you for your advice!
No branches or pull requests
Steps to Reproduce:
c2ab239
SourceGeneratorTest.TestState.Sources depends on generated source code.
Expected Behavior:
Success
Actual Behavior:
Adding diagnostics to ExpectedDiagnostics will solve the problem, but it is different from the actual compilation result.
The text was updated successfully, but these errors were encountered: