You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: XrmPluginCore.SourceGenerator/DiagnosticDescriptors.cs
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ internal static class DiagnosticDescriptors
58
58
title:"Handler signature does not match registered images",
59
59
messageFormat:"Handler method '{0}' does not have expected signature. Expected parameters in order: {1}. PreImage must be the first parameter, followed by PostImage if both are used.",
title:"Handler signature does not match registered images",
86
+
messageFormat:"Handler method '{0}' does not have expected signature. Expected parameters in order: {1}. PreImage must be the first parameter, followed by PostImage if both are used.",
Copy file name to clipboardExpand all lines: XrmPluginCore.SourceGenerator/rules/XPC4003.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,13 @@
2
2
3
3
## Severity
4
4
5
-
Error
5
+
Warning
6
6
7
7
## Description
8
8
9
-
This rule reports when a handler method's signature does not match the images registered with `WithPreImage()`, `WithPostImage()`, or `AddImage()`. The handler method must accept parameters in a specific order: `PreImage` first (if registered), then `PostImage` (if registered).
9
+
This rule reports when a handler method's signature does not match the images registered with `WithPreImage()`, `WithPostImage()`, or `AddImage()`, **and** the generated `PreImage`/`PostImage` types don't exist yet. The handler method must accept parameters in a specific order: `PreImage` first (if registered), then `PostImage` (if registered).
10
+
11
+
This is a **warning** to allow the initial build to succeed so that the source generator can create the wrapper types. Once the types exist, this diagnostic escalates to [XPC4006](XPC4006.md) (Error).
10
12
11
13
## ❌ Examples of violations
12
14
@@ -126,7 +128,13 @@ public interface IAccountService
126
128
127
129
Visual Studio and other IDEs supporting Roslyn analyzers will offer a code fix to update the method signature to match the registered images.
128
130
131
+
## Relationship with XPC4006
132
+
133
+
-**XPC4003 (Warning)**: Reported when the generated types don't exist yet. This allows the initial build to succeed so the types can be generated.
134
+
-**XPC4006 (Error)**: Reported when the generated types exist but the signature is still wrong. This prevents runtime failures.
135
+
129
136
## See also
130
137
138
+
-[XPC4006: Handler signature does not match registered images (types exist)](XPC4006.md)
131
139
-[XPC4002: Handler method not found](XPC4002.md)
132
140
-[XPC4004: Image registration without method reference](XPC4004.md)
# XPC4006: Handler signature does not match registered images (types exist)
2
+
3
+
## Severity
4
+
5
+
Error
6
+
7
+
## Description
8
+
9
+
This rule reports when a handler method signature does not match the registered images **and** the generated `PreImage`/`PostImage` types already exist. This is the escalated version of [XPC4003](XPC4003.md) that becomes an error once the types have been generated.
10
+
11
+
When you register images with `WithPreImage()` or `WithPostImage()`, the source generator creates type-safe wrapper classes. Your handler method must accept these wrapper types as parameters in the correct order.
0 commit comments