Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -145,6 +145,11 @@ public class AutoInterfaceGenerator : ISourceGenerator
|
||||
var interfaceName = InferInterfaceName(implTypeSymbol, attributeData);
|
||||
var visibilityModifier = InferVisibilityModifier(implTypeSymbol, attributeData);
|
||||
|
||||
//https://stackoverflow.com/questions/55492214/the-annotation-for-nullable-reference-types-should-only-be-used-in-code-within-a fix for nullable
|
||||
if (implTypeSymbol.NullableAnnotation == NullableAnnotation.Annotated)
|
||||
{
|
||||
codeWriter.WriteLine("#nullable enable");
|
||||
}
|
||||
codeWriter.WriteLine("namespace {0}", namespaceName);
|
||||
codeWriter.WriteLine("{");
|
||||
|
||||
@@ -163,6 +168,10 @@ public class AutoInterfaceGenerator : ISourceGenerator
|
||||
--codeWriter.Indent;
|
||||
|
||||
codeWriter.WriteLine("}");
|
||||
if (implTypeSymbol.NullableAnnotation == NullableAnnotation.Annotated)
|
||||
{
|
||||
codeWriter.WriteLine("#nullable restore");
|
||||
}
|
||||
|
||||
codeWriter.Flush();
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
Reference in New Issue
Block a user