From e71fd81fe8459d2c308164b9a4517631e51178a5 Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Fri, 29 Oct 2021 16:29:45 +0100 Subject: [PATCH] Type inference for out var differs by compiler (#8312) While our CI seems happy with this line of code on master, my machine with the 3.1 sdk is resolving it to non-nullable type and complaining about the "= null" line later. ``` LocalWorkspace.cs(389,27): error CS8600: Converting null literal or possible null value to non-nullable type. [/workspaces/pulumi/sdk/dotnet/Pulumi.Automation/Pulumi.Automation.csproj] ``` Quick fix to just not use "var" here. --- sdk/dotnet/Pulumi.Automation/LocalWorkspace.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/dotnet/Pulumi.Automation/LocalWorkspace.cs b/sdk/dotnet/Pulumi.Automation/LocalWorkspace.cs index 4bd8f2d22..981e0e1d2 100644 --- a/sdk/dotnet/Pulumi.Automation/LocalWorkspace.cs +++ b/sdk/dotnet/Pulumi.Automation/LocalWorkspace.cs @@ -384,7 +384,7 @@ namespace Pulumi.Automation internal static SemVersion? ParseAndValidatePulumiVersion(SemVersion minVersion, string currentVersion, bool optOut) { - if (!SemVersion.TryParse(currentVersion, out var version)) + if (!SemVersion.TryParse(currentVersion, out SemVersion? version)) { version = null; }