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

Wpf: Ignore exceptions when calling GC.TryStartNoGCRegion #2683

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/Eto.Wpf/Forms/Controls/TextBoxHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,17 @@ public string Text
// Improve performance when setting text often
// See https://github.com/dotnet/wpf/issues/5887#issuecomment-1604577981
var endNoGCRegion = EnableNoGCRegion
&& GCSettings.LatencyMode != GCLatencyMode.NoGCRegion
&& GC.TryStartNoGCRegion(1000000); // is this magic number reasonable??
&& GCSettings.LatencyMode != GCLatencyMode.NoGCRegion;

try
{
endNoGCRegion &= GC.TryStartNoGCRegion(1000000); // is this magic number reasonable??
}
catch
{
// Ignore any exceptions, they can apparently still happen even though we check the LatencyMode above
endNoGCRegion = false;
}

try
{
Expand Down
Loading