Version: 8.0.0 (Also reproduced with the built in analyzers in the Net 8 SDK)
Describe the bug
When I use the library EBind that uses collection initializers as part of it's syntax, the roslyn analizers recomend me to simplify the collection initialization:
this._bindings = new EBinding()
{
() => this.MyProperty == viewModel.MyProperty,
() => this.MyOtherProperty == GetMyOtherProperty(viewModel.MyOtherProperty),
};
// EBinding is declared in the library as:
public class EBinding : IEBinding, IDisposable, IReadOnlyCollection<IEBinding>, IEnumerable<IEBinding>, IEnumerable { ... }
When the fixer is applied, the code looks like this:
Analyzer
Diagnostic ID: IDE0028:
Use collection initializers or expressions
Analyzer source
NuGet Package: Microsoft.CodeAnalysis.NetAnalyzers
Version: 8.0.0 (Also reproduced with the built in analyzers in the Net 8 SDK)
Describe the bug
When I use the library EBind that uses collection initializers as part of it's syntax, the roslyn analizers recomend me to simplify the collection initialization:
When the fixer is applied, the code looks like this:
And both lines inside the collection give me this error:
Steps To Reproduce
I am not 100% sure why this is a breaking change as I am not still super familliar with the new collection initialization.
But I think applying the rule breaks the build because the
EBinding
class uses multipleAdd
s with different signatures:But I am not sure.
Expected behavior
Either:
Actual behavior
Additional context