Conversation
…tiple requests When Update/Create is triggered via UpdateMultipleRequest/CreateMultipleRequest, plugins registered on the single operation with post-images crashed because the Multiple->Single cross-trigger passed null for pre/post images. - Add null guards for preImage/postImage in AddPostImageAttributesToEntity - Fix operator precedence bug in CreatePluginContext where ImageType.Both bypassed null check - Retrieve per-entity images from DB in Multiple->Single cross-trigger - Make Core.TryRetrieve internal so PluginManager can access it Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Issue: #311
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes plugin image handling when CreateMultiple/UpdateMultiple cross-triggers Create/Update steps, preventing NullReferenceException for plugins that rely on post/pre images and improving correctness of image population in the generated plugin execution context.
Changes:
- Add null guards in
AddPostImageAttributesToEntityto prevent NREs when pre/post images are not available. - Fix operator precedence in
CreatePluginContextsoImageType.Bothno longer bypasses the null check. - In Multiple→Single cross-triggering, retrieve per-entity images from the in-memory DB via
Core.TryRetrieve(and exposeTryRetrieveinternally to allow this).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/XrmMockup365Test/TestMultipleRequestPluginImages.cs |
Adds regression tests covering UpdateMultiple/CreateMultiple image behavior and cross-trigger stability. |
tests/TestPluginAssembly365/Plugins/ContactPostImageOnUpdatePlugin.cs |
Adds a test plugin that asserts PostEntityImages presence by creating a Task with a marker. |
src/XrmMockup365/Plugin/PluginTrigger.cs |
Adds null guards and fixes image-type conditional precedence when building plugin images. |
src/XrmMockup365/Plugin/PluginManager.cs |
Retrieves per-entity images during Multiple→Single cross-trigger and wires them into plugin triggering. |
src/XrmMockup365/Core.cs |
Makes TryRetrieve internal for reuse by PluginManager; also fixes a log message character. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… tests Use RegisterPluginStep (avoids XrmPluginCore method group resolution bug with RegisterStep that causes StackOverflow). Simplify test assertions to focus on verifying the NullReferenceException fix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Issue: #311
Resolve conflicts in PluginManager.cs by taking master's IPluginExecutionContext4 image collection implementation, which supersedes our TryRetrieve-based approach. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Issue: #311
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When Update/Create is triggered via UpdateMultipleRequest/CreateMultipleRequest, plugins registered on the single operation with post-images crashed because the Multiple->Single cross-trigger passed null for pre/post images.
Fixes Issue: #311