Skip to content

Commit

Permalink
Merge pull request #2683 from cwensley/curtis/wpf-textbox-gc-stuff-ye…
Browse files Browse the repository at this point in the history
…t-again

Wpf: Ignore exceptions when calling GC.TryStartNoGCRegion
  • Loading branch information
cwensley authored Sep 11, 2024
2 parents 89fbc96 + 021d677 commit 4451ef7
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit 4451ef7

Please sign in to comment.