-
Notifications
You must be signed in to change notification settings - Fork 7
Document auto-injection behavior and limitations #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
miloszkukla
wants to merge
7
commits into
faze79:main
from
miloszkukla:agent/document-injection-limitations
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
24720e1
Fix auto-injection packaging
miloszkukla 3d784de
Document auto-injection limitations
miloszkukla 77d304d
Add .NET Framework 4.7.2 support
miloszkukla 978e30f
Remove .NET Framework target from injector
miloszkukla 4aab3bb
Multitarget shared tests
miloszkukla c5d873b
Merge net472 support into packaging stack
miloszkukla 79787f5
Merge packaging stack into injection documentation
miloszkukla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,7 +107,7 @@ command list. Output is JSON on stdout; diagnostics go to stderr. | |
| | Interaction surface | click (UIA + physical, double/right), set-text w/ read-back, send-keys, **select-item (virtualized)** | click / type / select | usually invoke-only | | ||
| | Wait for element conditions | ✅ `wpf_wait_for` | ✅ | ❌ | | ||
| | Popup / dropdown / context-menu screenshots | ✅ screen mode | partial | screenshot only | | ||
| | Cross-architecture injection (x64 ⇄ x86) | ✅ | n/a | ❌ | | ||
| | Cross-architecture injection (x64 server → x86 target) | ✅ | n/a | ❌ | | ||
| | Dual-mode: MCP server **and** one-shot CLI | ✅ | ❌ | ❌ | | ||
| | Distribution | NuGet (`dnx`/tool) + official MCP registry | varies | varies | | ||
|
|
||
|
|
@@ -226,7 +226,36 @@ Add to your Cursor settings (`.cursor/mcp.json`): | |
| } | ||
| ``` | ||
|
|
||
| ### Self-Hosted Mode (Recommended) | ||
| ### Auto-Injection Mode | ||
|
|
||
| Auto-injection loads the Inspector into an already-running WPF process without | ||
| source changes. Set `auto_inject=true` when calling `wpf_attach`, or run: | ||
|
|
||
| ```powershell | ||
| wpfinspect attach --pid <process-id> --auto-inject | ||
| ``` | ||
|
|
||
| Auto-injection has these constraints: | ||
|
|
||
| - It requires permission to open the target process, write memory, and create a | ||
| remote thread. Elevated, protected, sandboxed, or security-hardened processes | ||
| may reject it, and endpoint security may block it as DLL injection. | ||
| - The matching x64 or x86 native bootstrapper and the complete Inspector | ||
| dependency set must be present. A 64-bit server additionally needs the | ||
| bundled x86 helper and the x86 .NET 8 runtime to inject into a 32-bit target. | ||
| Native ARM64 targets are not supported. | ||
| - Injection occurs after process startup, so it cannot recover earlier binding | ||
| errors or initialization activity. A restarted application must be injected | ||
| again under its new process ID. | ||
| - The target must have an initialized WPF `Application` and a responsive UI | ||
| dispatcher. The injected Inspector remains loaded until the target exits. | ||
| - Loading native and managed code into the target can conflict with its runtime, | ||
| assembly versions, or process-hardening policy. | ||
|
|
||
| See the [injector documentation](src/WpfVisualTreeMcp.Injector/README.md) for the | ||
| implementation, runtime requirements, diagnostics, and detailed limitations. | ||
|
|
||
| ### Self-Hosted Mode | ||
|
|
||
| For your WPF application to be inspectable, add a reference to the Inspector DLL and initialize it on startup: | ||
|
|
||
|
|
@@ -258,6 +287,8 @@ public partial class App : Application | |
| ``` | ||
|
|
||
| This enables the MCP server to connect to your application via named pipes for real-time inspection. | ||
| The Inspector multi-targets .NET Framework 4.7.2, .NET Framework 4.8, and | ||
| .NET 8 for Windows, so project references select a compatible build. | ||
|
|
||
| ## Usage Examples | ||
|
|
||
|
|
@@ -469,7 +500,7 @@ WpfVisualTreeMcp/ | |
| │ │ ├── WpfTools.cs # 20 WPF tools (17 inspection + click/set-text/send-keys) | ||
| │ │ ├── Cli/CliRunner.cs # One-shot CLI front-end (v0.4.0) | ||
| │ │ └── Services/ # Process & IPC management | ||
| │ ├── WpfVisualTreeMcp.Inspector/ # Injected DLL (.NET Framework 4.8) | ||
| │ ├── WpfVisualTreeMcp.Inspector/ # Injected DLL (.NET Framework 4.7.2/4.8 and .NET 8) | ||
| │ ├── WpfVisualTreeMcp.Injector/ # Managed injection logic (CreateRemoteThread; net48 + net8.0) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| │ ├── WpfVisualTreeMcp.InjectorHelper/# x86 .NET 8 helper exe for cross-arch injection (v0.6.0) | ||
| │ ├── WpfVisualTreeMcp.Bootstrapper/ # Native C++ DLL for CLR hosting | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superseded by consolidated PR #22, whose description explicitly presents and explains the complete code, workflow, packaging, documentation, and test scope.