Skip to content

Do not throw when detecting bug Corefx29898 - #2123

Merged
slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:utf_bug_detect_no_throw
Oct 29, 2026
Merged

slozier merged 1 commit into
IronLanguages:mainfrom
BCSharp:utf_bug_detect_no_throw

Conversation

@BCSharp

@BCSharp BCSharp commented Oct 28, 2026

Copy link
Copy Markdown
Member

Currently, the bug exists on .NET Framework, but not on .NET (in the past it was on some versions of .NET Core IIRC).

The change eliminates the try-catch, so we get two benefits:

  1. It does not interrupt the debugger because an exception is being thrown.
  2. It is faster — on both frameworks, though the gain is obviously the biggest on .NET Framework. Even then this code executes only once per process, lazily, so the gain is a mere ~25 µs, so negligible.

The patch was sitting in my stash for 7 years, so it's time to submit it or drop it.

@slozier slozier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Every little bit helps. 😄

@slozier
slozier merged commit a0dc844 into IronLanguages:main Oct 29, 2026
55 of 56 checks passed
@BCSharp
BCSharp deleted the utf_bug_detect_no_throw branch October 29, 2026 00:08
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