Common issues and solutions for AvaloniaUI.MCP server.
Error: The server failed to start or connection refused
Check .NET Version
dotnet --version
# Should show 9.0.x or laterVerify Project Build
cd AvaloniaUI.MCP
dotnet clean
dotnet buildCheck for Port Conflicts
# Kill any existing processes
pkill -f "AvaloniaUI.MCP"
# Start with verbose logging
export AVALONIA_MCP_LOG_LEVEL=Debug
dotnet run --project src/AvaloniaUI.MCP/AvaloniaUI.MCP.csprojValidate Configuration
# Test server manually
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | dotnet run --project src/AvaloniaUI.MCP/AvaloniaUI.MCP.csprojUnhandled exception: System.OutOfMemoryException
Memory Management
# Enable server GC
export DOTNET_gcServer=1
export DOTNET_gcConcurrent=1
# Set memory limits
export DOTNET_GCHeapHardLimit=400000000 # 400MB limitCheck Resource Usage
Use the DiagnosticTool: "Perform a health check"
Use the DiagnosticTool: "Force garbage collection"
Review Logs
export AVALONIA_MCP_LOG_LEVEL=Information
dotnet run --project src/AvaloniaUI.MCP/AvaloniaUI.MCP.csproj 2>&1 | tee server.logMCP client cannot connect to server
Verify STDIO Configuration
{
"mcpServers": {
"avalonia": {
"command": "dotnet",
"args": [
"run",
"--project",
"/absolute/path/to/AvaloniaUI.MCP/src/AvaloniaUI.MCP/AvaloniaUI.MCP.csproj"
],
"cwd": "/absolute/path/to/AvaloniaUI.MCP"
}
}
}Test Connection
# Manual test
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | dotnet run --project src/AvaloniaUI.MCP/AvaloniaUI.MCP.csprojCheck Permissions
# Ensure executable permissions
chmod +x src/AvaloniaUI.MCP/bin/Debug/net9.0/AvaloniaUI.MCP
# Check file access
ls -la src/AvaloniaUI.MCP/AvaloniaUI.MCP.csprojError: Tool execution failed with status code 1
Check Tool Metrics
Use DiagnosticTool: "Get server metrics"
Validate Input Parameters
"Validate my project name 'My-Invalid@Name'"
# Should suggest valid alternatives
Test Individual Tools
"Test the echo tool with message 'hello world'"
# Should respond with the echoed message
Error: Invalid XAML syntax
Get Detailed Validation
"Validate this XAML and provide detailed error information"
Check Common Issues
- Missing namespace declarations
- Unclosed tags
- Invalid property names
- Binding syntax errors
Use Incremental Validation
"Validate just the Window tag first"
"Now validate with the StackPanel added"
Error: Project generation failed
Check Directory Permissions
# Ensure write access
touch test-file.txt && rm test-file.txtValidate Project Name
"Is 'MyApp123' a valid project name?"
Try Simplified Generation
"Create a basic project instead of MVVM"
"Generate only the essential files"
Tool responses taking > 5 seconds
Check Cache Performance
Use DiagnosticTool: "Get server metrics"
# Look for cache hit rate < 80%
Clear Cache
Use DiagnosticTool: "Clear resource cache"
Optimize Environment
# Production settings
export ENVIRONMENT=production
export AVALONIA_MCP_LOG_LEVEL=Warning
export DOTNET_gcServer=1Monitor Resource Usage
Use DiagnosticTool: "Force garbage collection and show memory stats"
Server memory usage > 500MB
Check Memory Pressure
Use DiagnosticTool: "Perform health check"
# Will show memory usage warnings
Restart Server Periodically
# Schedule periodic restarts for long-running instances
# Add to cron: 0 */6 * * * pkill -f AvaloniaUI.MCPOptimize Caching
# Reduce cache size
export AVALONIA_MCP_CACHE_SIZE=50 # Default 100CS0246: The type or namespace name could not be found
Restore Packages
dotnet clean
dotnet restore
dotnet buildCheck Package Versions
dotnet list package --outdated
dotnet list package --vulnerableVerify SDK Version
dotnet --list-sdks
# Should include 9.0.xTest run failed: X tests failed
Run Specific Test Categories
# Run only unit tests
dotnet test --filter Category=Unit
# Run only integration tests
dotnet test --filter Category=IntegrationCheck Test Output
dotnet test --verbosity detailedReset Test Environment
# Clean test artifacts
rm -rf tests/*/bin tests/*/obj
dotnet testSystem.ArgumentNullException: Value cannot be null
Enable Detailed Logging
export AVALONIA_MCP_LOG_LEVEL=TraceCheck Input Validation
"Test input validation with empty parameters"
Use Error Handling Tools
"Show me the last 10 error events"
Use DiagnosticTool: "Test logging at error level"
"Perform a comprehensive health check"
"Get current server metrics"
"Show memory usage and GC statistics"
"Test all service components"
"Force garbage collection"
"Clear all caches"
"Show cache hit rates"
"Display tool execution statistics"
"Test logging functionality at debug level"
"Show recent error events"
"Display server configuration"
"Check file system permissions"
export AVALONIA_MCP_LOG_LEVEL=Debug # Trace|Debug|Information|Warning|Error|Critical
export ENVIRONMENT=development # development|staging|productionexport DOTNET_gcServer=1 # Enable server GC
export DOTNET_gcConcurrent=1 # Enable concurrent GC
export DOTNET_GCHeapHardLimit=400000000 # 400MB memory limitexport AVALONIA_MCP_CACHE_SIZE=100 # Number of cached items
export AVALONIA_MCP_CACHE_TTL=3600 # Cache TTL in seconds- Use DiagnosticTool for health checks
- Review server logs with debug level
- Test individual components
- Check environment configuration
When reporting issues, include:
- Server version and .NET version
- Operating system and architecture
- Complete error message and stack trace
- Steps to reproduce
- Server configuration and environment variables
- Output from health check diagnostic
## Bug Report
**Environment:**
- OS: Ubuntu 22.04 / Windows 11 / macOS 13
- .NET Version: 9.0.x
- Server Version: 1.0.0
**Issue:**
Brief description of the problem
**Steps to Reproduce:**
1. Start server with: `dotnet run...`
2. Execute command: "Create project..."
3. Error occurs
**Expected Behavior:**
What should happen
**Actual Behavior:**
What actually happens
**Logs:**[Paste relevant log output]
**Health Check Output:**
[Output from diagnostic health check]
**Additional Context:**
Any other relevant information