Urgent.News

What's breaking now, across thousands of outlets.

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…

When creating MCP servers in .NET using instance-based tool classes, such as those taking ILogger<T>, HttpClient, or repositories through constructor injection, users may have encountered a runtime crash. This issue is not flagged by warnings or compile-time errors, leading to silence at startup and a crash during production. The source material explains the root cause and provides a two-line fix in DotnetFastMCP v2.1 to address this problem.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

NO idea where to start learning SQL?

This article is a beginner friendly guide that gets you started into learning SQL as a programming language. Introduction Relational databases store data in tabular form, often referred to as…

  • SQL is a language for interacting with relational databases.
  • Key concepts include tables, databases, and SQL command categories.
  • Start with the SELECT statement to retrieve data from tables.

Weekend Build Log: The Timeout Is the Product

You sit down Saturday with one failing test file. The stack trace is ugly and long. You want a tiny helper that groups those failures. Ninety minutes later you are still retrying a model.

  • Programmer groups failing test files together
  • Timeout set as product, limiting job to one verb
  • Sunday run with tight scope and 90-second limit

More from Sunday 13 September →