diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 756c0a6..3cc92f4 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -10,6 +10,7 @@ "${workspaceFolder}/EmoTracker.sln", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary", + "/nodeReuse:false", "/p:EmoTrackerRegularBuild=1" ], "problemMatcher": "$msCompile", @@ -31,6 +32,7 @@ "Debug", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary", + "/nodeReuse:false", "/p:EmoTrackerRegularBuild=1" ], @@ -49,6 +51,7 @@ "Release", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary", + "/nodeReuse:false", "/p:EmoTrackerRegularBuild=1" ], @@ -65,6 +68,7 @@ "Release", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary", + "/nodeReuse:false", "/p:EmoTrackerRegularBuild=1" ], diff --git a/EmoTracker.SourceGenerators/EmoTracker.SourceGenerators.csproj b/EmoTracker.SourceGenerators/EmoTracker.SourceGenerators.csproj index b649810..063f7e2 100644 --- a/EmoTracker.SourceGenerators/EmoTracker.SourceGenerators.csproj +++ b/EmoTracker.SourceGenerators/EmoTracker.SourceGenerators.csproj @@ -29,16 +29,23 @@ and keeps a file lock on it for the entire VS Code session. This prevents regular builds from copying an updated DLL to the same location. - Fix: when building via VS Code tasks (which pass /p:EmoTrackerRegularBuild=1), - redirect the output to a separate "-build" directory so regular builds and the - language server write to different paths and never contend on the same file. + Fix: VS Code build tasks pass /p:EmoTrackerRegularBuild=1, which redirects + the output to a separate "bin\-build\" directory. The lock stays on + the server's "bin\\" copy; regular builds write to "-build\" freely. The consuming project (EmoTracker.Data) resolves the analyzer path via - $(TargetPath) which follows $(OutputPath), so both the generator and its - consumer use the correct path within the same build invocation. + $(TargetPath) which follows $(OutputPath) + AppendTargetFrameworkToOutputPath, + so both the generator and its consumer use the correct path within the same + build invocation. /nodeReuse:false in the tasks ensures no stale MSBuild node + cache from the server can override this property. --> - bin\$(Configuration)-build\$(TargetFramework)\ + + bin\$(Configuration)-build\ diff --git a/EmoTracker/Extensions/McpServer/McpServerExtension.cs b/EmoTracker/Extensions/McpServer/McpServerExtension.cs index 6109e34..2524a99 100644 --- a/EmoTracker/Extensions/McpServer/McpServerExtension.cs +++ b/EmoTracker/Extensions/McpServer/McpServerExtension.cs @@ -200,7 +200,18 @@ private async Task StartServerAsync() UpdateClientConnectedFlag(); } - await next(ctx); + try + { + await next(ctx); + } + catch (OperationCanceledException) + { + // Client disconnected mid-request; this is normal for + // long-running SSE streams and streaming POST responses. + // Suppress so it doesn't surface as an unhandled exception. + if (!ctx.Response.HasStarted) + ctx.Response.StatusCode = 499; // Client Closed Request + } }); mApp.MapMcp();