-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
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
Added #pragma warning disable CS1591 to supress warnings in the source generated code #8940
Added #pragma warning disable CS1591 to supress warnings in the source generated code #8940
Conversation
Thank you for opening this PR, @m3nax! I was looking for the Roslyn-native way to do this. It might look something like this, in CodeGenerator.cs before we return the var disabledWarnings = new List<string>();
assemblyAttributes[0] = assemblyAttributes[0]
.WithLeadingTrivia(
SingletonList(
PragmaWarningDirectiveTrivia(
Token(SyntaxKind.DisableKeyword),
SeparatedList(disabledWarnings.Select(w => (ExpressionSyntax)w.GetLiteralExpression())), isActive: true)));
return CompilationUnit()
.WithAttributeLists(List(assemblyAttributes))
.WithMembers(List(namespaces)); |
I Will test It tomorrow |
@ReubenBond I have updated the implementation as you suggested but, as it is the first time I have modified a source generator, I did not understand how to remove the double quotes from the list of warnings to be suppressed Now the output of orleans.g,cs is like this: #pragma warning disable "CS1591"
[assembly: global::Orleans.ApplicationPartAttribute("ConsoleApp1")]
[assembly: global::Orleans.ApplicationPartAttribute("Orleans.Core.Abstractions")]
[assembly: global::Orleans.ApplicationPartAttribute("Orleans.Serialization")]
[assembly: global::Orleans.Serialization.Configuration.TypeManifestProviderAttribute(typeof(OrleansCodeGen.ConsoleApp1.Metadata_ConsoleApp1))]
namespace OrleansCodeGen.ConsoleApp1
{
// CODE
}
#pragma warning restore "CS1591" Do you have any suggestions? |
@ReubenBond Problem fixed |
Fantastic, thank you, @m3nax! |
Description
Added
#pragma warning disable CS1591
and"#pragma warning restore CS1591
to the source generated file to supress warnings when projects contains<GenerateDocumentationFile>True</GenerateDocumentationFile>
Fixes #8290