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
{{ message }}
Repository navigation
CS0433 Compiler Error: 'NotNullWhenAttribute' exists in both 'Mapster' and 'System.Runtime' #893
When using Mapster (v10.0.4) in a .NET 7 project, a CS0433 compilation error occurs because the NotNullWhenAttribute is exposed publicly by the Mapster package, which collides with the built-in attribute in System.Runtime.
using System.Diagnostics.CodeAnalysis;
namespace MapperTest;
public class Tests
{
public Tests()
{
}
protected virtual bool TryLoadAssembly(
string filePath,
[NotNullWhen(true)] out string assembly
)
{
assembly = null;
return false;
}
}
Build the project.
Observed Behavior
The build fails with the following compiler error:
error CS0433: The type 'NotNullWhenAttribute' exists in both 'Mapster, Version=10.0.4.0, Culture=neutral, PublicKeyToken=2f39883af23c29a8' and 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Activity
fix: MapsterMapper#893
chore: Merge pull request #894 from DocSvartz/build-simplicate-part-2
DocSvartz commentedon Mar 25, 2026
Hi @RainbowWolfer, it fixed in https://www.nuget.org/packages/Mapster/10.0.6.
Thanks!
DocSvartz commentedon Mar 26, 2026
This should have been fixed in new release version.
If your issue is still active, please reopen it or create new issue.
Thanks!