Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"${workspaceFolder}/EmoTracker.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"/nodeReuse:false",
"/p:EmoTrackerRegularBuild=1"
],
"problemMatcher": "$msCompile",
Expand All @@ -31,6 +32,7 @@
"Debug",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"/nodeReuse:false",
"/p:EmoTrackerRegularBuild=1"
],

Expand All @@ -49,6 +51,7 @@
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"/nodeReuse:false",
"/p:EmoTrackerRegularBuild=1"
],

Expand All @@ -65,6 +68,7 @@
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"/nodeReuse:false",
"/p:EmoTrackerRegularBuild=1"
],

Expand Down
19 changes: 13 additions & 6 deletions EmoTracker.SourceGenerators/EmoTracker.SourceGenerators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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\<Config>-build\" directory. The lock stays on
the server's "bin\<Config>\" 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.
-->
<PropertyGroup Condition="'$(EmoTrackerRegularBuild)' == '1'">
<OutputPath>bin\$(Configuration)-build\$(TargetFramework)\</OutputPath>
<!--
Do NOT include $(TargetFramework) here — AppendTargetFrameworkToOutputPath=true
(default) will append netstandard2.0 automatically. Including it manually
would produce a doubled path like "netstandard2.0\netstandard2.0\".
-->
<OutputPath>bin\$(Configuration)-build\</OutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
13 changes: 12 additions & 1 deletion EmoTracker/Extensions/McpServer/McpServerExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading