Skip to content
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

Null reference exception when performing INSTRUMENT operation #484

Open
arp-mbender opened this issue Jun 27, 2024 · 2 comments
Open

Null reference exception when performing INSTRUMENT operation #484

arp-mbender opened this issue Jun 27, 2024 · 2 comments

Comments

@arp-mbender
Copy link

arp-mbender commented Jun 27, 2024

After some debugging I found the problem:

                        attribute = new CrmPluginRegistrationAttribute(
                            step.sdkmessageid_sdkmessageprocessingstep.Name,
                            filter == null ? "none" : filter.PrimaryObjectTypeCode,
                            (StageEnum)Enum.ToObject(typeof(StageEnum), step.Stage.Value),
                            step.Mode.Value == 0 ? ExecutionModeEnum.Synchronous : ExecutionModeEnum.Asynchronous,
                            step.FilteringAttributes,
                            step.Name,
                            step.Rank.HasValue ? step.Rank.Value : 1,
                            step.plugintypeid_sdkmessageprocessingstep.pluginassembly_plugintype.IsolationMode == pluginassembly_isolationmode.Sandbox
                                ? IsolationModeEnum.Sandbox : IsolationModeEnum.None
                            )
                        {
                            Id = step.Id.ToString(),
                            DeleteAsyncOperation = step.Mode.Value != 0 && step.AsyncAutoDelete.Value, // <- in this line step.AsyncAutoDelete is NULL; this needs a null check
                        };

An example fix would be to replace the latter part of the logic operator with step.AsyncAutoDelete == true.

However, on top of that, it seems the query used to populate the step lacks the AsyncAutoDelete completely, meaning this is always null.

@arp-mbender
Copy link
Author

arp-mbender commented Jun 27, 2024

In addition the generated code for AsyncAutoDelete uses True, as in uppercase T, which doesn't compile in C#.

@arp-mbender
Copy link
Author

@scottdurow I've fixed this in a PR. But... this project seems to be unmaintained any more. :(

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

No branches or pull requests

1 participant