Adds a description to an InvalidOperationException for clarity. #8019
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.
This should "fix" #8004, if that's something the maintainers wish to do something about.
I was porting some really old XNA code to MonoGame and bumped into an issue where I got an
InvalidOperationException
. I think the exception was correct, but in order to understand what was going on, I had to pull down the code and step through it to discover that the effect's type was expected to implementIEffectMatrices
. Once I saw that, I knew how to fix it. But I had to dig quite deep to find it.This change would hopefully prevent somebody else from having to do the same digging in the future.
On the original issue, there was a comment by @nkast suggesting another possible solution: Just do a cast and let the runtime handle things. I feel that solution would also address my problem, if we'd rather go that route. Though that might run a slightly higher risk of breaking people, since it changes the exception type.
If the maintainers would prefer that solution, or any other tweaks to this solution, let me know and I'll change it.
If we don't want to do anything with this at all, you won't hurt my feelings to just decline this PR.