Tech
Why Your .NET MCP Tool Classes Crash at Runtime (And the Two-Line Fix)
If you're building MCP servers in .NET with instance-based tool classes — the kind that take ILogger<T> , HttpClient , or a repository through constructor injection — there's a good chance you've already hit this at runtime:
System.Reflection.TargetException: Non-static method requires a target.
No warning at startup. No compile-time error. Just a crash the moment an AI model calls your tool in production.
This post explains why it happens, shows the two-line fix in ...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to