-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversion error (CS0029) during compilation in .NET SDK 8.0.300 #40893
Comments
This seems related to the design change dotnet/csharplang#7783. The following demonstrates a difference between compiler versions, without referencing Newtonsoft.Json: using System;
using System.Collections;
using System.Collections.Generic;
class Collection : IEnumerable<Item1>
{
IEnumerator<Item1> IEnumerable<Item1>.GetEnumerator() => throw new NotImplementedException();
IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedException();
public IEnumerator<Item2> GetEnumerator() => throw new NotImplementedException();
public void Add(object obj) => throw new NotImplementedException();
}
struct Item1
{
}
struct Item2
{
}
class Demo
{
Collection collection = [ new Item1(), "hoh" ];
} .NET SDK 8.0.205:
.NET SDK 8.0.300:
The older SDK deduces the collection element type from the In the Newtonsoft.Json case, JObject has a |
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: