Skip to content
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

Fix nullability in compiled model #25676

Merged
merged 1 commit into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private string CreateModel(
_instance = model;
}")
.AppendLine()
.Append("private static ").Append(className).AppendLine(nullable ? "? _instance;" : " _instance;")
.Append("private static ").Append(className).AppendLine(" _instance;")
.AppendLine("public static IModel Instance => _instance;")
.AppendLine()
.AppendLine("partial void Initialize();")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ static BigContextModel()
_instance = model;
}

private static BigContextModel? _instance;
private static BigContextModel _instance;
public static IModel Instance => _instance;

partial void Initialize();
Expand Down Expand Up @@ -3619,7 +3619,8 @@ protected void Test(
BuildReference.ByName("Newtonsoft.Json"),
BuildReference.ByName(typeof(CSharpRuntimeModelCodeGeneratorTest).Assembly.GetName().Name)
},
Sources = scaffoldedFiles.ToDictionary(f => f.Path, f => f.Code)
Sources = scaffoldedFiles.ToDictionary(f => f.Path, f => f.Code),
NullableReferenceTypes = options.UseNullableReferenceTypes
};

var assembly = build.BuildInMemory();
Expand Down
3 changes: 1 addition & 2 deletions test/EFCore.Design.Tests/TestUtilities/BuildSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ private CSharpCompilationOptions CreateOptions()
OutputKind.DynamicallyLinkedLibrary,
nullableContextOptions: NullableReferenceTypes ? NullableContextOptions.Enable : NullableContextOptions.Disable,
reportSuppressedDiagnostics: false,
// TODO: Uncomment when #18950 is fixed
//generalDiagnosticOption: ReportDiagnostic.Error,
generalDiagnosticOption: ReportDiagnostic.Error,
specificDiagnosticOptions: new Dictionary<string, ReportDiagnostic>()
{
{ "CS1030", ReportDiagnostic.Suppress },
Expand Down