Remove Assembly.GetCallingAssembly (#133)

This is always called from M.E.DI. That's not a good name to use here.
This commit is contained in:
Stephen Toub 2025-03-28 20:46:53 -04:00 • committed by GitHub
commit d47c834fa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,11 +27,11 @@ internal sealed class McpServerOptionsSetup(
// if it otherwise lacks server information. // if it otherwise lacks server information.
if (options.ServerInfo is not { } serverInfo) if (options.ServerInfo is not { } serverInfo)
{ {
var assemblyName = (Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly()).GetName(); var assemblyName = Assembly.GetEntryAssembly()?.GetName();
options.ServerInfo = new() options.ServerInfo = new()
{ {
Name = assemblyName.Name ?? "McpServer", Name = assemblyName?.Name ?? "McpServer",
Version = assemblyName.Version?.ToString() ?? "1.0.0", Version = assemblyName?.Version?.ToString() ?? "1.0.0",
}; };
} }