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
Hi, we are using Azure DevOps pipeline to run our test and after the .NET 9.0.200 upgrade we have some IDE0040 error showing up and lead to failure (as we have warning as error I think).
The following interface have error on the ValidationError property :
public interface IValidationResult
{
public static readonly Error ValidationError = new("ValidationError", "A validation problem occurred.");
/// <summary>
/// Gets the errors.
/// </summary>
Error[] Errors { get; }
}
To Reproduce
I setup a class library project with the following files :
IFoo.cs
namespace ClassLibrary1;
public interface IFoo
{
public static readonly string FooString = "foo";
}
Foo.cs
namespace ClassLibrary1;
public class Foo : IFoo
{
private string FooValue { get; set; }= IFoo.FooString;
}
It seems like defining the access modifier inside the interface throw error
Exceptions (if any)
Further technical details
Using JetBrains Rider 2024.3.5
Add a Directory.Build.props file :
<Project>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<AnalysisLevel>9.0</AnalysisLevel>
<AnalysisMode>All</AnalysisMode>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(MSBuildProjectName).xml</DocumentationFile>
<!-- warning CS1591: Missing XML comment for publicly visible type or member -->
<NoWarn>1591,1574</NoWarn>
</PropertyGroup>
</Project>
Yeah, it's all the same issue. Thanks for the link @KalleOlaviNiemitalo. @tomflenner I'm assuming you requested that this diagnostic be reported as an error in your .editorconfig?
This catches me out about once a year! Part of the confusion is that the .Net version in ADO goes up before the latest version of Visual Studio comes out with the same .Net version, so there's a bit of head scratching whilst you figure out why you have no warnings in VS but there are some in the pipeline. When this happens, I change my UseDotNet@2 step in my pipeline to a specific version of .NET, matching what I have locally from Visual Studio (which I can find out from dotnet --list-sdks). Then once VS catches up I change it back to 9.0.x etc. Hope that helps others.
Describe the bug
Hi, we are using Azure DevOps pipeline to run our test and after the .NET 9.0.200 upgrade we have some IDE0040 error showing up and lead to failure (as we have warning as error I think).
The following interface have error on the ValidationError property :
To Reproduce
I setup a class library project with the following files :
IFoo.cs
Foo.cs
It seems like defining the access modifier inside the interface throw error
Exceptions (if any)
Further technical details
Directory.Build.props
file :.editorconfig
file :The bug does not seems to be related to Rider because of the Azure DevOps pipeline failure.
If you have more question, don't hesitate !
Thanks in advance 🙏🏻
The text was updated successfully, but these errors were encountered: