diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs index a73816d388713e..8e5fa07ec8da8a 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs @@ -271,7 +271,7 @@ private MessageContainer(MessageCategory category, DiagnosticId id, string subca public string ToMSBuildString() { - const string originApp = "ILC"; + const string originApp = "ILC "; // extra space for MSBuild sake: https://github.com/dotnet/runtime/issues/118788 string origin = Origin?.ToString() ?? originApp; StringBuilder sb = new StringBuilder(); diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs index 98b214e2b4785a..c47a0a8af4472f 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs @@ -213,8 +213,10 @@ private void CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeN if (exception != null) { + var mdOwningType = method.OwningType as MetadataType; + string owningAssembly = mdOwningType?.Module?.Assembly?.GetName()?.Name ?? ""; if (exception is TypeSystemException.InvalidProgramException - && method.OwningType is MetadataType mdOwningType + && mdOwningType != null && mdOwningType.HasCustomAttribute("System.Runtime.InteropServices", "ClassInterfaceAttribute")) { Logger.LogWarning(method, DiagnosticId.COMInteropNotSupportedInFullAOT); @@ -222,7 +224,7 @@ private void CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeN if ((_compilationOptions & RyuJitCompilationOptions.UseResilience) != 0) Logger.LogMessage($"Method '{method}' will always throw because: {exception.Message}"); else - Logger.LogError($"Method will always throw because: {exception.Message}", 1005, method, MessageSubCategory.AotAnalysis); + Logger.LogError($"Method in '{owningAssembly}' will always throw because: {exception.Message}", 1005, method, MessageSubCategory.AotAnalysis); // Try to compile the method again, but with a throwing method body this time. MethodIL throwingIL = TypeSystemThrowingILEmitter.EmitIL(method, exception); diff --git a/src/tools/illink/src/linker/Linker/MessageContainer.cs b/src/tools/illink/src/linker/Linker/MessageContainer.cs index cf104999fd123a..cad211eea84037 100644 --- a/src/tools/illink/src/linker/Linker/MessageContainer.cs +++ b/src/tools/illink/src/linker/Linker/MessageContainer.cs @@ -293,7 +293,8 @@ private MessageContainer(MessageCategory category, DiagnosticId id, string subca public string ToMSBuildString() { const string originApp = Constants.ILLink; - string origin = Origin?.ToString() ?? originApp; + string origin = Origin?.ToString() + ?? $"{originApp} "; // extra space for MSBuild sake: https://github.com/dotnet/runtime/issues/118788 StringBuilder sb = new StringBuilder(); sb.Append(origin).Append(':');