dotnet/BenchmarkDotNet · error · ArgumentException
Inconsistent versions: '{assemblyVersion}' and '{fullVersion
Error message
Inconsistent versions: '{assemblyVersion}' and '{fullVersion}' What it means
Thrown by the BenchmarkDotNetInfo constructor when FullVersion does not start with the expected version prefix derived from AssemblyVersion. The constructor builds a prefix (full 4-part version if Revision > 0, else 3-part) and checks FullVersion.StartsWith(versionPrefix). A mismatch indicates the assembly version and the informational/full version string are out of sync, which can cause incorrect branding or diagnostic output.
Source
Thrown at src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs:46
public string FullVersion { get; }
public bool IsDevelop { get; }
public bool IsNightly { get; }
public bool IsRelease { get; }
public string BrandTitle { get; }
public string BrandVersion { get; }
public BenchmarkDotNetInfo(Version assemblyVersion, string fullVersion)
{
AssemblyVersion = assemblyVersion;
FullVersion = fullVersion;
string versionPrefix = AssemblyVersion.Revision > 0
? AssemblyVersion.ToString()
: AssemblyVersion.ToString(3);
if (!FullVersion.StartsWith(versionPrefix))
throw new ArgumentException($"Inconsistent versions: '{assemblyVersion}' and '{fullVersion}'");
string versionSuffix = FullVersion.Substring(versionPrefix.Length).TrimStart('-');
IsDevelop = versionSuffix.StartsWith("develop");
IsNightly = AssemblyVersion.Revision > 0;
IsRelease = versionSuffix.IsEmpty() && AssemblyVersion.Revision <= 0;
string brandVersionSuffix = IsDevelop
? " (" + DateTime.Now.ToString("yyyy-MM-dd") + ")"
: "";
BrandVersion = FullVersion + brandVersionSuffix;
BrandTitle = "BenchmarkDotNet v" + BrandVersion;
}
internal static string RemoveVersionMetadata(string version)
{
int index = version.IndexOf('+');
return index >= 0 ? version.Substring(0, index) : version;
}View on GitHub (pinned to b515068b61)
Solutions
- Ensure AssemblyVersion and AssemblyInformationalVersion are consistent: the informational version must start with the assembly version's major.minor.build prefix.
- If using Directory.Build.props or versioning tools, verify both version fields are driven from the same source.
- In CI, check that the version override step updates both fields.
Example fix
// before (mismatched versions in csproj)
[assembly: AssemblyVersion("0.13.1.0")]
[assembly: AssemblyInformationalVersion("0.14.0-develop")]
// after
[assembly: AssemblyVersion("0.13.1.0")]
[assembly: AssemblyInformationalVersion("0.13.1-develop")] Defensive patterns
Strategy: validation
Validate before calling
// In build scripts, verify version consistency
var asmVersion = typeof(BenchmarkDotNetInfo).Assembly.GetName().Version;
var infoVersion = FileVersionInfo.GetVersionInfo(typeof(BenchmarkDotNetInfo).Assembly.Location).ProductVersion;
if (!infoVersion.StartsWith(asmVersion.Revision > 0 ? asmVersion.ToString() : asmVersion.ToString(3)))
throw new InvalidOperationException("Version mismatch detected."); Prevention
- Drive both AssemblyVersion and AssemblyInformationalVersion from a single version property in Directory.Build.props.
- Validate version consistency in CI before publishing packages.
- Use a versioning tool (MinVer, Nerdbank.GitVersioning) that keeps both fields synchronized.
When it happens
Trigger: Thrown at src/BenchmarkDotNet/Properties/BenchmarkDotNetInfo.cs:46 when the library encounters an invalid state.
Common situations: Building BenchmarkDotNet from source with a modified version pipeline, using MinVer or other auto-versioning tools that set informational version independently of assembly version, or after a partial version bump that touched one but not the other.
Related errors
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/45e6b5572c12d5f6.
Report an issue: GitHub.