Skip to content

Fix cross-framework build compatibility for MCP integration - #2

Open
faze79 wants to merge 4 commits into
developfrom
claude/add-mcp-server-button-01BWB7afwQBp92qKPRRC8Vqt
Open

faze79 wants to merge 4 commits into
developfrom
claude/add-mcp-server-button-01BWB7afwQBp92qKPRRC8Vqt

Conversation

@faze79

@faze79 faze79 commented Dec 10, 2025

Copy link
Copy Markdown
Owner

Summary

Fixed build errors across all target frameworks (.NET Framework 4.6.2, .NET 6.0, .NET 8.0) for the MCP integration feature.

Changes Made

.NET Framework 4.6.2 Compatibility Fixes

  • ✅ Replaced C# 8+ range operators [..n] with Substring(0, n)
  • ✅ Fixed StreamWriter constructor to include bufferSize parameter
  • ✅ Updated WriteAsync to use offset/length parameters
  • ✅ Added null-forgiving operators to resolve nullable reference warnings

.NET 8.0 MCP SDK Compatibility Fixes

  • ✅ Changed server URL configuration to use webApplication.Urls.Add() instead of UseUrls/ConfigureKestrel
  • ✅ Simplified server startup using RunAsync() instead of StartAsync + WaitForShutdownAsync

StyleCop Compliance

  • ✅ Separated multiple attributes onto different lines
  • ✅ Added blank lines between property declarations
  • ✅ Replaced empty string literals "" with string.Empty

Package Updates

  • ✅ Updated System.Text.Json to 10.0.0 for MCP SDK compatibility

Build Status

All target frameworks now build successfully:

  • ✅ .NET Framework 4.6.2
  • ✅ .NET 6.0
  • ✅ .NET 8.0

Files Modified

  • Snoop.Core/Infrastructure/MCP/McpServer.cs - Cross-framework API compatibility fixes
  • Snoop.Core/Infrastructure/MCP/SnoopMcpTools.cs - StyleCop compliance fixes
  • Directory.packages.props - System.Text.Json version update (already in previous commit)

Testing

  • Verified successful build across all target frameworks
  • No breaking changes to existing functionality
  • MCP Server feature ready for testing once inspector window injection is working

🤖 Generated with Claude Code

- Removed version history from README.md (kept reference to Changelog)
- Updated Changelog.md with MCP integration as new feature in v6.1.0
- Simplified documentation to focus on MCP feature addition
- All version references updated to 6.1.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The XAML file had invalid CDATA wrapper tags that were causing build errors.
Removed the wrapper to fix XML parsing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Added C# 11 language version support for MCP features
- Fixed XAML file: removed invalid CDATA wrapper from McpServerWindow.xaml
- Fixed McpServer.cs:
  - Removed unnecessary async from StartAsync method
  - Changed tools array to explicitly typed object[]
  - Added generic type parameter to InvokeAsync calls
  - Fixed using directives ordering (System.Linq before System.Net)
  - Replaced empty strings with string.Empty
- Fixed SnoopMcpTools.cs:
  - Updated McpServerTool attributes to use parameterless constructor
  - Replaced empty strings with string.Empty
- Added System.Text.Json 10.0.0 package dependency for MCP support

Note: Additional work needed for full .NET Framework 4.6.2 and .NET 8.0 compatibility
- .NET 6.0 build succeeds
- .NET Framework 4.6.2 needs System.Range/Index polyfills
- .NET 8.0 has MCP SDK API compatibility issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix .NET Framework 4.6.2 compatibility:
  * Replace C# 8+ range operators with Substring()
  * Fix StreamWriter constructor signature
  * Fix WriteAsync signature for .NET Framework
  * Add null-forgiving operators where needed

- Fix .NET 8 MCP SDK compatibility:
  * Use webApplication.Urls.Add() instead of UseUrls/ConfigureKestrel
  * Simplify server startup with RunAsync()

- Fix StyleCop violations:
  * Separate multiple attributes onto different lines
  * Add blank lines between properties
  * Use string.Empty instead of empty string literals

- Update System.Text.Json to 10.0.0 for MCP SDK compatibility

All target frameworks now build successfully:
- .NET Framework 4.6.2 ✓
- .NET 6.0 ✓
- .NET 8.0 ✓

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants