Open
Description
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.
[...]\SampleClass.cs(262,16): error CS0029: Cannot implicitly convert type 'Newtonsoft.Json.Linq.JProperty' to 'System.Collections.Generic.KeyValuePair<string, Newtonsoft.Json.Linq.JToken?>
The lines in question are the following
using Newtonsoft.Json.Linq;
[...]
List<JObject> sqlColumnValues =
[
[
new JProperty(TAB_NAME.Fields.COL_CODE_1, -1),
new JProperty(TAB_NAME.Fields.COL_CODE_2, val2),
new JProperty(TAB_NAME.Fields.COL_CODE_3, val3),
new JProperty(TAB_NAME.Fields.COL_CODE_4, val4),
new JProperty(TAB_NAME.Fields.COL_CODE_5, val5),
new JProperty(TAB_NAME.Fields.COL_CODE_6, val6),
new JProperty(TAB_NAME.Fields.COL_CODE_7, val7),
new JProperty(TAB_NAME.Fields.COL_CODE_8, val8)
]
];
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?>