From 1ac1ac426ef55f6050c918778cd4cca8b5d3da9c Mon Sep 17 00:00:00 2001 From: Peter Shrosbree Date: Thu, 15 Oct 2026 10:54:33 -0700 Subject: [PATCH] Fix two missing ILVerify diagnostic messages For errors reported by the IL importer, Verifier looks up the message in Strings.resx by the VerifierError name and falls back to that name if the entry is missing or empty. LdftnCtor's entry was named LdftnConstructor, and TailStackEmpty had no entry, so both were reported with the bare error name. Rename the former and add the latter using its enum comment. Add a test that every error other than None has a non-empty entry. --- .../VerificationResultTests.cs | 15 +++++++++++++++ src/coreclr/tools/ILVerification/Strings.resx | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/coreclr/tools/ILVerification.Tests/VerificationResultTests.cs b/src/coreclr/tools/ILVerification.Tests/VerificationResultTests.cs index 10cfc04faddd9b..73d02ab57e324a 100644 --- a/src/coreclr/tools/ILVerification.Tests/VerificationResultTests.cs +++ b/src/coreclr/tools/ILVerification.Tests/VerificationResultTests.cs @@ -1,6 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; +using System.Globalization; +using System.Linq; +using System.Resources; using ILVerify; using Xunit; @@ -17,5 +21,16 @@ public static void ArgumentLookupOnResultWithoutArguments() Assert.Equal(0, offset); Assert.Equal(0, result.GetArgumentValue("Offset")); } + + [Fact] + public static void EveryErrorHasMessage() + { + // Verifier looks up the message of an error by its name, and falls back to the name. + var strings = new ResourceManager("ILVerification.Strings", typeof(Verifier).Assembly); + VerifierError[] missing = Enum.GetValues() + .Where(e => e != VerifierError.None && string.IsNullOrEmpty(strings.GetString(e.ToString(), CultureInfo.InvariantCulture))) + .ToArray(); + Assert.Empty(missing); + } } } diff --git a/src/coreclr/tools/ILVerification/Strings.resx b/src/coreclr/tools/ILVerification/Strings.resx index 854d60df120939..6424bbd88f66b5 100644 --- a/src/coreclr/tools/ILVerification/Strings.resx +++ b/src/coreclr/tools/ILVerification/Strings.resx @@ -264,7 +264,7 @@ Cannot change initonly field outside its .ctor. - + ldftn/ldvirtftn not allowed on .ctor. @@ -408,6 +408,9 @@ Void ret type expected for tail call. + + Stack not empty after tail call. + The 'this' parameter to the call must be the calling method's 'this' parameter.