Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AssemblySymbolLoader logging #46102

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Jan 17, 2025

Fixes #46093

Also update the test to not assert on a an English string. Example loggings with these changes:

error CP1002: Could not resolve reference 'Microsoft.NET.StringTools.dll' directly or transitively referenced by 'lib/net462/Microsoft.AspNetCore.SignalR.Protocols.MessagePack.dll' (C:\git\aspnetcore\artifacts\packages\Debug\Shipping\Microsoft.AspNetCore.SignalR.Protocols.MessagePack.10.0.0-dev.nupkg) in any of the provided search directories.

Loading assemblies 'lib/netstandard2.0/Microsoft.AspNetCore.SignalR.Protocols.MessagePack.dll' from archive 'C:\git\aspnetcore\artifacts\packages\Debug\Shipping\Microsoft.AspNetCore.SignalR.Protocols.MessagePack.10.0.0-dev.nupkg'.

Assembly 'System.Reflection.Emit.ILGeneration.dll' loaded.

Assembly 'System.Reflection.Emit.ILGeneration.dll' referenced by 'System.Reflection.Emit.dll' loaded.

}

return metadataReference;
}

private MetadataReference CreateAndAddReferenceToCompilation(string name, Stream fileStream, ImmutableHashSet<string>? referenceAssemblyNamesToIgnore = null)
private MetadataReference CreateAndAddReferenceToCompilation(string assemblyName, string rootAssemblyDisplayString, Stream fileStream, ImmutableHashSet<string>? referenceAssemblyNamesToIgnore = null, string? referenceeAssemblyName = null)
Copy link
Member

Choose a reason for hiding this comment

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

typo:

Suggested change
private MetadataReference CreateAndAddReferenceToCompilation(string assemblyName, string rootAssemblyDisplayString, Stream fileStream, ImmutableHashSet<string>? referenceAssemblyNamesToIgnore = null, string? referenceeAssemblyName = null)
private MetadataReference CreateAndAddReferenceToCompilation(string assemblyName, string rootAssemblyDisplayString, Stream fileStream, ImmutableHashSet<string>? referenceAssemblyNamesToIgnore = null, string? referenceAssemblyName = null)

_cSharpCompilation = _cSharpCompilation.AddReferences([ metadataReference ]);

if (referenceeAssemblyName is null)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (referenceeAssemblyName is null)
if (referenceAssemblyName is null)

}
else
{
_log.LogMessage(MessageImportance.Low, string.Format(Resources.AssemblyReferenceLoaded, assemblyName, referenceeAssemblyName));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_log.LogMessage(MessageImportance.Low, string.Format(Resources.AssemblyReferenceLoaded, assemblyName, referenceeAssemblyName));
_log.LogMessage(MessageImportance.Low, string.Format(Resources.AssemblyReferenceLoaded, assemblyName, referenceAssemblyName));

@ViktorHofer ViktorHofer merged commit 982a3c4 into main Jan 20, 2025
35 of 38 checks passed
@ViktorHofer ViktorHofer deleted the ImproveAssemblySymbolLoaderLogging branch January 20, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-ApiCompat untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CP1002 AssemblySymbolLoader warning needs more information
2 participants