Skip to content

Remove some types of false positives from Eraser's data race reports#107

Merged
acizmarik merged 5 commits intomainfrom
fix/eraser-false-positives
Feb 1, 2026
Merged

Remove some types of false positives from Eraser's data race reports#107
acizmarik merged 5 commits intomainfrom
fix/eraser-false-positives

Conversation

@acizmarik
Copy link
Owner

This PR does the following changes:

  • Fix shadow variable state transitioning (previously we mistakenly marked some situations as racy)
  • Fix field access ordering events around .cctor
  • Track last write access for every shadow variable (previously we could have dropped state that was necessary for reports)
  • Add suppression SuppressAnalysisOfStaticDelegates that skips analyzing static fields with type Delegate as it generates a lot of noise. Roslyn uses this a lot following pattern to compile, for example lambdas:
	.class nested private auto ansi sealed serializable beforefieldinit '<>c'<T>
		extends System.Object
	{
		.custom instance void System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
			01 00 00 00
		)
		// Fields
		.field public static initonly class System.Buffers.SharedArrayPool`1/'<>c'<!T> '<>9'
		.field public static class System.Func`2<object, bool> '<>9__11_0'
	} // end of class <>c
  • There is a public mutable field <>c.<>9__11_0 whose initialization is not synchronized. There can be multiple places that use the field. Its initialization is racy but since delegates are immutable and always point exactly to the same place, it is benign

@acizmarik acizmarik added this to the 2.1.0 milestone Feb 1, 2026
@acizmarik acizmarik marked this pull request as ready for review February 1, 2026 17:35
@acizmarik acizmarik merged commit ee4afae into main Feb 1, 2026
6 of 8 checks passed
@acizmarik acizmarik deleted the fix/eraser-false-positives branch February 1, 2026 17:35
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.

1 participant