You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today we came across a really strange issue during a scheduled pipeline run (AzDO) for a dotnet core repo.
A project that was compiled without any issues yesterday, threw the following error - although there were no code changes.
[...]\SampleClass.cs(262,16): error CS0029: Cannot implicitly convert type 'Newtonsoft.Json.Linq.JProperty' to 'System.Collections.Generic.KeyValuePair<string, Newtonsoft.Json.Linq.JToken?>
Upon further investigation we noticed that the automated Azure DevOps pipeline used the latest dotnet SDK version today (v8.0.300),
instead of v8.0.204 that was used up until yesterday. We downgraded the SDK version in the build environment to v8.0.204 and the project was compiled successfully without further issues.
To Reproduce
The issue was reproduced on dev environments running 8.0.300.
Use dotnet SDK 8.0.300 to build a project that utilizes C# 12 syntactic sugar for array initialization.
Sample list provided above.
Exceptions (if any)
[...]\SampleClass.cs(262,16): error CS0029: Cannot implicitly convert type 'Newtonsoft.Json.Linq.JProperty' to 'System.Collections.Generic.KeyValuePair<string, Newtonsoft.Json.Linq.JToken?>
Further technical details
dotnet --info (dev machine)
CLI build
The text was updated successfully, but these errors were encountered:
Class1.cs(26,44): error CS0029: Cannot implicitly convert type 'string' to 'Item1'
.NET SDK 8.0.300:
Class1.cs(26,31): error CS0029: Cannot implicitly convert type 'Item1' to 'Item2'
Class1.cs(26,44): error CS0029: Cannot implicitly convert type 'string' to 'Item2'
The older SDK deduces the collection element type from the IEnumerable<Item1> interface, but the newer SDK deduces it from public IEnumerator<Item2> GetEnumerator() instead.
In the Newtonsoft.Json case, JObject has a public IEnumerator<KeyValuePair<string, JToken>> GetEnumerator() method and implements IEnumerable<KeyValuePair<string, JToken>>, but its base class JContainer implements IEnumerable<JToken>. It's not clear to me which version of the speclet .NET SDK 8.0.204 implements.
We had code that was impacted by this change as well, and it was rather frustrating to understand why it was happening due to the fact that the 8.0.300 SDK has to be installed manually and doesn't work with Visual Studio 17.9.7.
Describe the bug
Hi everyone,
Today we came across a really strange issue during a scheduled pipeline run (AzDO) for a dotnet core repo.
A project that was compiled without any issues yesterday, threw the following error - although there were no code changes.
The lines in question are the following
Upon further investigation we noticed that the automated Azure DevOps pipeline used the latest dotnet SDK version today (v8.0.300),
instead of v8.0.204 that was used up until yesterday. We downgraded the SDK version in the build environment to v8.0.204 and the project was compiled successfully without further issues.
To Reproduce
The issue was reproduced on dev environments running 8.0.300.
Exceptions (if any)
Further technical details
dotnet --info (dev machine)
CLI build
The text was updated successfully, but these errors were encountered: