Analyzer
Diagnostic ID: RS1035 The symbol '{0}' is banned for use by analyzers: Analyzers should not read their settings directly from environment variables
Analyzer source
Unknown, I am using SDK 6.0.405 and the following Nuget packages
Microsoft.CodeAnalysis.CSharp 4.3.0
Microsoft.CodeAnalysis.Analyzers 3.3.4
Microsoft.CodeAnalysis.Workspaces.Common 4.3.0
Describe the bug
When I use Environment.NewLine inside a source generator, I get the error
Error RS1035 : The symbol 'Environment' is banned for use by analyzers: Analyzers should not read their settings directly from environment variables.
I understand that it maybe be dangerous to read settings from environment variables but the class Environment has members that AFAIK have nothing to do with environment variables and therefore should be save to use.
In the case of Environment.NewLine, what is the right way add a newline dynamically in generated code?
Steps To Reproduce
- Create a source generator using the SDK and nuget pakages mentioned above
- Use
Environment.NewLine anywhere in the generator,
- See error
Expected behavior
No error occurs when I use Environment.NewLine
Actual behavior
The error
Error RS1035 : The symbol 'Environment' is banned for use by analyzers: Analyzers should not read their settings directly from environment variables
occurs.
Analyzer
Diagnostic ID: RS1035
The symbol '{0}' is banned for use by analyzers: Analyzers should not read their settings directly from environment variablesAnalyzer source
Unknown, I am using SDK 6.0.405 and the following Nuget packages
Microsoft.CodeAnalysis.CSharp 4.3.0
Microsoft.CodeAnalysis.Analyzers 3.3.4
Microsoft.CodeAnalysis.Workspaces.Common 4.3.0
Describe the bug
When I use
Environment.NewLineinside a source generator, I get the errorI understand that it maybe be dangerous to read settings from environment variables but the class
Environmenthas members that AFAIK have nothing to do with environment variables and therefore should be save to use.In the case of
Environment.NewLine, what is the right way add a newline dynamically in generated code?Steps To Reproduce
Environment.NewLineanywhere in the generator,Expected behavior
No error occurs when I use
Environment.NewLineActual behavior
The error
occurs.