From 3c0368e2854e969c20e96984d9978f3d7f7a18a2 Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Tue, 16 Jul 2019 17:22:54 -0700 Subject: [PATCH] Fix nullability warnings from compiler update --- src/System.Private.CoreLib/shared/System/AppDomain.cs | 6 +++--- .../shared/System/Diagnostics/Tracing/EventSource.cs | 2 +- src/System.Private.CoreLib/shared/System/Progress.cs | 2 +- .../shared/System/Runtime/Loader/AssemblyLoadContext.cs | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/System.Private.CoreLib/shared/System/AppDomain.cs b/src/System.Private.CoreLib/shared/System/AppDomain.cs index 88856a5..d48d349 100644 --- a/src/System.Private.CoreLib/shared/System/AppDomain.cs +++ b/src/System.Private.CoreLib/shared/System/AppDomain.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#pragma warning disable CS0067 // events are declared but not used +#pragma warning disable CS0414 // events are assigned but not used using System.Diagnostics; using System.IO; @@ -67,7 +67,7 @@ namespace System public bool IsHomogenous => true; - public event EventHandler DomainUnload; + public event EventHandler DomainUnload = null!; public event EventHandler FirstChanceException { @@ -244,7 +244,7 @@ namespace System remove { AssemblyLoadContext.AssemblyResolve -= value; } } - public event ResolveEventHandler ReflectionOnlyAssemblyResolve; + public event ResolveEventHandler ReflectionOnlyAssemblyResolve = null!; public event ResolveEventHandler TypeResolve { diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs index bf25248..b749234 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs @@ -4060,7 +4060,7 @@ namespace System.Diagnostics.Tracing /// This event is raised whenever an event has been written by a EventSource for which /// the EventListener has enabled events. /// - public event EventHandler EventWritten; + public event EventHandler EventWritten = null!; static EventListener() { diff --git a/src/System.Private.CoreLib/shared/System/Progress.cs b/src/System.Private.CoreLib/shared/System/Progress.cs index f298493..12557da 100644 --- a/src/System.Private.CoreLib/shared/System/Progress.cs +++ b/src/System.Private.CoreLib/shared/System/Progress.cs @@ -56,7 +56,7 @@ namespace System /// Handlers registered with this event will be invoked on the /// captured when the instance was constructed. /// - public event EventHandler ProgressChanged; + public event EventHandler ProgressChanged = null!; /// Reports a progress change. /// The value of the updated progress. diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs b/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs index 1210987..c952686 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/Loader/AssemblyLoadContext.cs @@ -38,11 +38,11 @@ namespace System.Runtime.Loader // synchronization primitive to protect against usage of this instance while unloading private readonly object _unloadLock; - private event Func _resolvingUnmanagedDll; + private event Func _resolvingUnmanagedDll = null!; - private event Func _resolving; + private event Func _resolving = null!; - private event Action _unloading; + private event Action _unloading = null!; private readonly string? _name; -- 2.7.4