Fix crash when event does not have `Add` method and improve message for some other internal errors by lostmsu · Pull Request #2409 · pythonnet/pythonnet · GitHub
Skip to content

Fix crash when event does not have Add method and improve message for some other internal errors#2409

Merged
filmor merged 3 commits intopythonnet:masterfrom
losttech:InternalError
Jul 2, 2024
Merged

Fix crash when event does not have Add method and improve message for some other internal errors#2409
filmor merged 3 commits intopythonnet:masterfrom
losttech:InternalError

Conversation

@lostmsu
Copy link
Copy Markdown
Member

@lostmsu lostmsu commented Jul 1, 2024

What does this implement/fix? Explain your changes.

  1. Fixes crash on events with no AddMethod
  2. Adds InternalPythonnetException that can tell user what .NET type caused failure if an unexpected internal error occurs

Does this close any currently open issues?

#2405

Checklist

Check all those that are applicable and complete.

@filmor
Copy link
Copy Markdown
Member

filmor commented Jul 2, 2024

@lostmsu
Copy link
Copy Markdown
Member Author

lostmsu commented Jul 2, 2024

@filmor the fix is the new null check in ShouldBindEvent.

The rest is to make it easier to do bug reports: the error data will now at least contain the name of the type that we failed to process.

@filmor
Copy link
Copy Markdown
Member

filmor commented Jul 2, 2024

I see. Still don't see why making ShouldBindEvent special in that it swallows the error instead of throwing is better than just behaving like this uniformly. I'd rather have none of these functions throw, but at least it fixes the reported issue.

@filmor filmor merged commit 9ebfbde into pythonnet:master Jul 2, 2024
@lostmsu
Copy link
Copy Markdown
Member Author

lostmsu commented Jul 2, 2024

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.

2 participants