Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,18 @@ private void CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeN

if (exception != null)
{
var mdOwningType = method.OwningType as MetadataType;
string owningAssembly = mdOwningType?.Module?.Assembly?.GetName()?.Name ?? "<unknown>";
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The assembly name extraction logic uses multiple null-conditional operators in sequence, which could be simplified for better readability. Consider extracting this into a helper method or using a more explicit approach to handle the null cases.

Copilot uses AI. Check for mistakes.
if (exception is TypeSystemException.InvalidProgramException
&& method.OwningType is MetadataType mdOwningType
&& mdOwningType != null
&& mdOwningType.HasCustomAttribute("System.Runtime.InteropServices", "ClassInterfaceAttribute"))
{
Logger.LogWarning(method, DiagnosticId.COMInteropNotSupportedInFullAOT);
}
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);
Expand Down
Loading