Visitar URL original
Fix MCP server crash: missing IVariableTrackingService DI registration by Copilot · Pull Request #729 · dotnet-outdated/dotnet-outdated · GitHub
Skip to content

Fix MCP server crash: missing IVariableTrackingService DI registration - #729

Merged
slang25 merged 5 commits into
masterfrom
copilot/fix-mcp-server-issue
Mar 21, 2026
Merged

slang25 merged 5 commits into
masterfrom
copilot/fix-mcp-server-issue

Conversation

Copilot AI commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

DotNetPackageService gained an IVariableTrackingService dependency in #714, but the DI container in McpCommand.cs was not updated — only Program.cs was. Running dotnet-outdated mcp throws InvalidOperationException at startup.

  • Added IVariableTrackingService registration in McpCommand.cs, matching the existing registration in Program.cs
.AddSingleton<IVariableTrackingService>(provider =>
    new VariableTrackingService(
        provider.GetService<IFileSystem>(),
        msg => provider.GetService<IReporter>().Warn(msg)))
Original prompt

This section details on the original issue you should resolve

<issue_title>MCP Server broken with 4.7.1</issue_title>
<issue_description>It looks like #714 missed updating the DI registration in https://github.com/dotnet-outdated/dotnet-outdated/blob/5fea9245ce268faaad7acb83a16f10ba847f9110/src/DotNetOutdated/McpCommand.cs to include the new IVariableTrackingService

dotnet-outdated mcp

Unhandled exception. System.InvalidOperationException: Unable to resolve service for type 'DotNetOutdated.Core.Services.IVariableTrackingService' while attempting to activate 'DotNetOutdated.Core.Services.DotNetPackageService'.
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateArgumentCallSites(ServiceIdentifier serviceIdentifier, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, ServiceIdentifier serviceIdentifier, Type implementationType, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, Int32 slot)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, Int32 slot)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.TryCreateExact(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.CreateCallSite(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteFactory.GetCallSite(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at DotNetOutdated.McpCommand.OnExecuteAsync(CommandLineApplication app) in /home/runner/work/dotnet-outdated/dotnet-outdated/src/DotNetOutdated/McpCommand.cs:line 31
   at McMaster.Extensions.CommandLineUtils.SourceGeneration.ReflectionExecuteHandler.InvokeAsyncMethod(Object instance, Object[] arguments)
   at McMaster.Extensions.CommandLineUtils.SourceGeneration.ReflectionExecuteHandler.InvokeAsync(Object model, CommandLineApplication app, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at DotNetOutdated.Program.Main(String[] args) in /home/runner/work/dotnet-outdated/dotnet-outdated/src/DotNetOutdated/Program.cs:line 173

</issue_description>

<agent_instructions>This is a good spot, let's get a fix in, and some sort of smoke test so that we find this type of issue for similar changes in future</agent_instructions>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI and others added 3 commits March 17, 2026 00:41
…d add smoke test

Co-authored-by: slang25 <1341446+slang25@users.noreply.github.com>
…d add smoke test

Co-authored-by: slang25 <1341446+slang25@users.noreply.github.com>
Co-authored-by: slang25 <1341446+slang25@users.noreply.github.com>
Copilot AI changed the title [WIP] [dotnet-outdated#714] Fix MCP server broken with 4.7.1 Fix MCP server missing IVariableTrackingService DI registration Mar 17, 2026
Copilot AI requested a review from slang25 March 17, 2026 00:45
Copilot AI changed the title Fix MCP server missing IVariableTrackingService DI registration Fix MCP server crash: missing IVariableTrackingService DI registration Mar 21, 2026
@slang25
slang25 marked this pull request as ready for review March 21, 2026 10:44
@slang25
slang25 merged commit 3dfd9c4 into master Mar 21, 2026
7 checks passed
@michaeldimoudis

Copy link
Copy Markdown

Hi @slang25 is it possible to create a new nuget package with this bugfix in there?

@alexravenna

Copy link
Copy Markdown

Hi @slang25 is it possible to create a new nuget package with this bugfix in there?

Yeah, this would be great! I just tried adding the tool with version 4.7.1 to my repo and told GitHub Copilot to use the MCP server to query one of the projects in my solution...I was a bit disappointed when the MCP server couldn't even start! ☹️

@slang25

slang25 commented May 28, 2026

Copy link
Copy Markdown
Member

on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Server broken with 4.7.1

4 participants