Skip to content

Fix NullReferenceException caused by null argument for custom attribute's array-typed ctor parameter #642

Merged
stakx merged 4 commits intocastleproject:masterfrom
stakx:bug/custom-attribute-with-null-ctor-arg
Dec 29, 2022
Merged

Fix NullReferenceException caused by null argument for custom attribute's array-typed ctor parameter #642
stakx merged 4 commits intocastleproject:masterfrom
stakx:bug/custom-attribute-with-null-ctor-arg

Conversation

@stakx
Copy link
Member

@stakx stakx commented Dec 28, 2022

Fixes #637. See commit messages for details.

(While not strictly necessary to fix the failing test, it still helps to
reduce the amount of code we need to look at.)
This is where the `NullReferenceException` happens.

The pre-existing comment here didn't explain *why* this special case is
needed at all, which only became apparent when I temporarily removed it.

Let's explain the intent behind the special case better, and move it
inside an `if` that triggers only when the right conditions are present
(which now excludes `null` values).
@stakx stakx added this to the vNext milestone Dec 28, 2022
@stakx stakx changed the title Bug/custom attribute with null ctor arg Fix NullReferenceException caused by null argument for custom attribute's array-typed ctor parameter Dec 28, 2022
@stakx
Copy link
Member Author

stakx commented Dec 28, 2022

This is another straightforward change that probably doesn't need a full review. I'll likely go ahead and merge this quite soon.

@stakx stakx merged commit 451c58f into castleproject:master Dec 29, 2022
@stakx stakx deleted the bug/custom-attribute-with-null-ctor-arg branch December 29, 2022 01:14
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

Successfully merging this pull request may close these issues.

Failure proxying type that has a non-inheritable custom attribute type applied where null argument is given for array parameter

2 participants