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

Fix a number of warnings. #1376

Merged
merged 1 commit into from Oct 5, 2020
Merged

Fix a number of warnings. #1376

merged 1 commit into from Oct 5, 2020

Conversation

bartdesmet
Copy link
Collaborator

Address a number of warnings in an attempt to get CI builds down to 0 warnings.

@bartdesmet bartdesmet merged commit 46d83e3 into main Oct 5, 2020
@bartdesmet bartdesmet deleted the dev/bartde/fix_warnings branch October 5, 2020 22:48
@bartdesmet
Copy link
Collaborator Author

bartdesmet commented Oct 5, 2020

Leftover 65 warnings to investigate at some point in the future (up for grabs):

src\Microsoft.Reactive.Testing\NamespaceDoc.cs(11,20): Warning CA1812: NamespaceDoc is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it static (Shared in Visual Basic).
src\Microsoft.Reactive.Testing\ReactiveTest.cs(128,95): Warning CA1801: Parameter witness of method OnError is never used. Remove the parameter or use it in the method body.
src\Microsoft.Reactive.Testing\ReactiveTest.cs(13,18): Warning CA1052: Type 'ReactiveTest' is a static holder type but is neither static nor NotInheritable
src\Microsoft.Reactive.Testing\ReactiveTest.cs(147,107): Warning CA1801: Parameter witness of method OnError is never used. Remove the parameter or use it in the method body.
src\Microsoft.Reactive.Testing\ReactiveTest.cs(78,78): Warning CA1801: Parameter witness of method OnCompleted is never used. Remove the parameter or use it in the method body.
src\System.Reactive\Concurrency\EventLoopScheduler.cs(48,40): Warning CA2213: 'EventLoopScheduler' contains field '_evt' that is of IDisposable type 'SemaphoreSlim', but it is never disposed. Change the Dispose method on 'EventLoopScheduler' to call Close or Dispose on this field.
src\System.Reactive\Concurrency\EventLoopScheduler.cs(64,42): Warning CA2213: 'EventLoopScheduler' contains field '_nextItem' that is of IDisposable type 'ScheduledItem<TimeSpan>?', but it is never disposed. Change the Dispose method on 'EventLoopScheduler' to call Close or Dispose on this field.
src\System.Reactive\Concurrency\ScheduledItem.cs(14,27): Warning CA1063: Provide an overridable implementation of Dispose(bool) on 'ScheduledItem' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources.
src\System.Reactive\Concurrency\ScheduledItem.cs(156,26): Warning CA1033: Make 'ScheduledItem' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'System.IDisposable.Dispose' and is visible to derived classes
src\System.Reactive\Concurrency\ScheduledItem.cs(156,26): Warning CA1063: Ensure that 'ScheduledItem.System.IDisposable.Dispose' is declared as public and sealed
src\System.Reactive\Concurrency\ScheduledItem.cs(156,26): Warning CA1063: Rename 'ScheduledItem.System.IDisposable.Dispose' to 'Dispose' and ensure that it is declared as public and sealed
src\System.Reactive\Concurrency\ScheduledItem.cs(156,26): Warning CA1816: Change ScheduledItem<TAbsolute>.Dispose() to call GC.SuppressFinalize(object). This will prevent derived types that introduce a finalizer from needing to re-implement 'IDisposable' to call it.
src\System.Reactive\Concurrency\Scheduler.Async.cs(15,54): Warning CA2213: 'AsyncInvocation<TState>' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on 'AsyncInvocation<TState>' to call Close or Dispose on this field.
src\System.Reactive\Concurrency\Scheduler.Services.Emulation.cs(339,45): Warning CA2213: 'SchedulePeriodicStopwatch<TState>' contains field '_resumeEvent' that is of IDisposable type 'AutoResetEvent', but it is never disposed. Change the Dispose method on 'SchedulePeriodicStopwatch<TState>' to call Close or Dispose on this field.
src\System.Reactive\Concurrency\SchedulerOperation.cs(46,42): Warning CA1024: Use properties where appropriate
src\System.Reactive\Concurrency\TaskPoolScheduler.cs(276,54): Warning CA2213: 'PeriodicallyScheduledWorkItem<TState>' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on 'PeriodicallyScheduledWorkItem<TState>' to call Close or Dispose on this field.
src\System.Reactive\Disposables\StableCompositeDisposable.cs(13,27): Warning CA1063: Provide an overridable implementation of Dispose(bool) on 'StableCompositeDisposable' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources.
src\System.Reactive\Disposables\StableCompositeDisposable.cs(81,30): Warning CA1063: Ensure that 'StableCompositeDisposable.Dispose' is declared as public and sealed
src\System.Reactive\EventPattern.cs(20,16): Warning CA2109: Consider making '.ctor' not externally visible
src\System.Reactive\IEventSource.cs(21,25): Warning CA1003: Change the event 'OnNext' to replace the type 'System.Action<T>' with a generic EventHandler, for example EventHandler<T>, where T is a valid EventArgs
src\System.Reactive\Internal\ExceptionHelper.cs(101,30): Warning CA1032: Add the following constructor to TerminatedException: public TerminatedException(string message)
src\System.Reactive\Internal\ExceptionHelper.cs(101,30): Warning CA1032: Add the following constructor to TerminatedException: public TerminatedException(string message, Exception innerException)
src\System.Reactive\Internal\ExceptionHelper.cs(101,30): Warning CA1064: Exceptions should be public
src\System.Reactive\Internal\ScheduledObserver.cs(59,41): Warning CA2213: 'ScheduledObserver<T>' contains field '_dispatcherEvent' that is of IDisposable type 'SemaphoreSlim?', but it is never disposed. Change the Dispose method on 'ScheduledObserver<T>' to call Close or Dispose on this field.
src\System.Reactive\Internal\ScheduledObserver.cs(60,39): Warning CA2213: 'ScheduledObserver<T>' contains field '_dispatcherEventRelease' that is of IDisposable type 'IDisposable?', but it is never disposed. Change the Dispose method on 'ScheduledObserver<T>' to call Close or Dispose on this field.
src\System.Reactive\Internal\ScheduledObserver.cs(61,30): Warning CA2213: 'ScheduledObserver<T>' contains field '_dispatcherJob' that is of IDisposable type 'IDisposable?', but it is never disposed. Change the Dispose method on 'ScheduledObserver<T>' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable.Blocking.cs(454,31): Warning CA1720: Identifier 'Single' contains type name
src\System.Reactive\Linq\Observable.Blocking.cs(475,31): Warning CA1720: Identifier 'Single' contains type name
src\System.Reactive\Linq\Observable.Creation.cs(260,67): Warning CA1801: Parameter witness of method Empty is never used. Remove the parameter or use it in the method body.
src\System.Reactive\Linq\Observable.Creation.cs(290,89): Warning CA1801: Parameter witness of method Empty is never used. Remove the parameter or use it in the method body.
src\System.Reactive\Linq\Observable.Creation.cs(392,67): Warning CA1801: Parameter witness of method Never is never used. Remove the parameter or use it in the method body.
src\System.Reactive\Linq\Observable.Creation.cs(582,88): Warning CA1801: Parameter witness of method Throw is never used. Remove the parameter or use it in the method body.
src\System.Reactive\Linq\Observable.Creation.cs(624,110): Warning CA1801: Parameter witness of method Throw is never used. Remove the parameter or use it in the method body.
src\System.Reactive\Linq\Observable.Multiple.CombineLatest.cs(1196,33): Warning CA1711: Either replace the suffix 'Ex' in type name ObservableEx with the suggested numeric alternate '2' or provide a more meaningful suffix that distinguishes it from the type it replaces
src\System.Reactive\Linq\Observable\Buffer.cs(653,44): Warning CA2213: '_' contains field '_bufferGate' that is of IDisposable type 'AsyncLock', but it is never disposed. Change the Dispose method on '_' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\Delay.cs(265,48): Warning CA2213: 'L' contains field '_evt' that is of IDisposable type 'SemaphoreSlim', but it is never disposed. Change the Dispose method on 'L' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\GetEnumerator.cs(22,40): Warning CA2213: 'GetEnumerator<TSource>' contains field '_gate' that is of IDisposable type 'SemaphoreSlim', but it is never disposed. Change the Dispose method on 'GetEnumerator<TSource>' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\Merge.cs(288,58): Warning CA2213: '_' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on '_' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\RepeatWhen.cs(39,27): Warning CA2201: Exception type System.NullReferenceException is reserved by the runtime
src\System.Reactive\Linq\Observable\RetryWhen.cs(164,63): Warning CA2201: Exception type System.Exception is not sufficiently specific
src\System.Reactive\Linq\Observable\RetryWhen.cs(40,27): Warning CA2201: Exception type System.NullReferenceException is reserved by the runtime
src\System.Reactive\Linq\Observable\SelectMany.cs(1484,58): Warning CA2213: '_' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on '_' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\SelectMany.cs(1618,58): Warning CA2213: '_' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on '_' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\SelectMany.cs(540,58): Warning CA2213: '_' contains field '_cancel' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on '_' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\SelectMany.cs(694,58): Warning CA2213: '_' contains field '_cancel' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on '_' to call Close or Dispose on this field.
src\System.Reactive\Linq\Observable\ToObservable.cs(28,43): Warning CA2213: '_' contains field '_enumerator' that is of IDisposable type 'IEnumerator<TSource>?', but it is never disposed. Change the Dispose method on '_' to call Close or Dispose on this field.
src\System.Reactive\Linq\QbservableEx.cs(16,33): Warning CA1711: Either replace the suffix 'Ex' in type name QbservableEx with the suggested numeric alternate '2' or provide a more meaningful suffix that distinguishes it from the type it replaces
src\System.Reactive\Linq\QueryLanguage.Creation.cs(172,58): Warning CA2213: 'Subscription' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on 'Subscription' to call Close or Dispose on this field.
src\System.Reactive\Linq\QueryLanguage.Creation.cs(252,58): Warning CA2213: 'Subscription' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on 'Subscription' to call Close or Dispose on this field.
src\System.Reactive\Linq\QueryLanguage.Creation.cs(99,58): Warning CA2213: 'Subscription' contains field '_cts' that is of IDisposable type 'CancellationTokenSource', but it is never disposed. Change the Dispose method on 'Subscription' to call Close or Dispose on this field.
src\System.Reactive\ObservableQuery.cs(82,104): Warning CS8625: Cannot convert null literal to non-nullable reference type.
src\System.Reactive\Platforms\UWP\IEventPatternSource.cs(21,54): Warning CA1003: Change the event 'OnNext' to replace the type 'Windows.Foundation.TypedEventHandler<TSender, TEventArgs>' with a generic EventHandler, for example EventHandler<T>, where T is a valid EventArgs
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(121,103): Warning CA1045: Consider a design that does not require that 'stateMachine' be a reference parameter
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(121,76): Warning CA1045: Consider a design that does not require that 'awaiter' be a reference parameter
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(157,109): Warning CA1045: Consider a design that does not require that 'stateMachine' be a reference parameter
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(157,82): Warning CA1045: Consider a design that does not require that 'awaiter' be a reference parameter
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(17,19): Warning CA1815: TaskObservableMethodBuilder should override Equals
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(17,19): Warning CA1815: TaskObservableMethodBuilder should override the equality (==) and inequality (!=) operators
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(34,54): Warning CA1000: Do not declare static members on generic types
src\System.Reactive\Runtime\CompilerServices\TaskObservableMethodBuilder.cs(42,60): Warning CA1045: Consider a design that does not require that 'stateMachine' be a reference parameter
src\System.Reactive\Subjects\AsyncSubject.cs(363,32): Warning CA1024: Use properties where appropriate
src\System.Reactive\Subjects\BehaviorSubject.cs(88,25): Warning CA1065: get_Value creates an exception of type Exception, an exception type that should not be raised in a property. If this exception instance might be raised, use a different exception type, convert this property into a method, or change this property's logic so that it no longer raises an exception.
src\System.Reactive\Subjects\SubjectBase.cs(11,27): Warning CA1063: Provide an overridable implementation of Dispose(bool) on 'SubjectBase' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources.
src\System.Reactive\Subjects\SubjectBase.cs(26,30): Warning CA1063: Ensure that 'SubjectBase.Dispose' is declared as public and sealed
src\System.Reactive\Subjects\SubjectBase.cs(38,48): Warning CA1716: In virtual/interface member SubjectBase<T>.OnError(Exception), rename parameter error so that it no longer conflicts with the reserved language keyword 'Error'. Using a reserved keyword as the name of a parameter on a virtual/interface member makes it harder for consumers in other languages to override/implement the member.

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.

None yet

1 participant