Skip to content

Commit dd55484

Browse files
authored
Remove ActivityDisposable conditional directives and replace with System.IDisposable | null (#18707)
1 parent 1ece5b4 commit dd55484

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

src/Compiler/Utilities/Activity.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module internal Activity =
8989

9090
let private activitySource = new ActivitySource(ActivityNames.FscSourceName)
9191

92-
let start (name: string) (tags: (string * string) seq) : ActivityDisposable =
92+
let start (name: string) (tags: (string * string) seq) : System.IDisposable | null =
9393
let activity = activitySource.CreateActivity(name, ActivityKind.Internal)
9494

9595
match activity with
@@ -100,7 +100,7 @@ module internal Activity =
100100

101101
activity.Start()
102102

103-
let startNoTags (name: string) : ActivityDisposable = activitySource.StartActivity name
103+
let startNoTags (name: string) : System.IDisposable | null = activitySource.StartActivity name
104104

105105
let addEventWithTags name (tags: (string * objnull) seq) =
106106
match Activity.Current with
@@ -127,7 +127,7 @@ module internal Activity =
127127

128128
let private profiledSource = new ActivitySource(ActivityNames.ProfiledSourceName)
129129

130-
let startAndMeasureEnvironmentStats (name: string) : ActivityDisposable = profiledSource.StartActivity(name)
130+
let startAndMeasureEnvironmentStats (name: string) : System.IDisposable | null = profiledSource.StartActivity(name)
131131

132132
type private GCStats = int[]
133133

src/Compiler/Utilities/Activity.fsi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ module internal Activity =
4040
module Events =
4141
val cacheHit: string
4242

43-
val startNoTags: name: string -> ActivityDisposable
43+
val startNoTags: name: string -> System.IDisposable | null
4444

45-
val start: name: string -> tags: (string * string) seq -> ActivityDisposable
45+
val start: name: string -> tags: (string * string) seq -> System.IDisposable | null
4646

4747
val addEvent: name: string -> unit
4848

4949
val addEventWithTags: name: string -> tags: (string * objnull) seq -> unit
5050

5151
module Profiling =
52-
val startAndMeasureEnvironmentStats: name: string -> ActivityDisposable
52+
val startAndMeasureEnvironmentStats: name: string -> System.IDisposable | null
5353
val addConsoleListener: unit -> IDisposable
5454

5555
module CsvExport =

src/Compiler/Utilities/NullnessShims.fs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ module internal NullnessShims =
2323
| _, null -> false
2424
| x, y -> nonNullEqualityFunc !!x !!y
2525

26-
#if BUILDING_WITH_LKG
27-
type ActivityDisposable = System.IDisposable
28-
#else
29-
type ActivityDisposable = System.IDisposable | null
30-
#endif
31-
3226
#if NET5_0_OR_GREATER
3327
// Argument type for overriding System.Object.Equals(arg)
3428
// Desktop frameworks as well as netstandard need plain 'obj' and are not annotated, NET5 and higher can use (obj|null)

0 commit comments

Comments
 (0)