From 1b4cf22dd18132b668a50e1121a28c9c8ea20030 Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Wed, 17 Jul 2019 20:07:03 -0700 Subject: [PATCH] Make all events nullable (dotnet/corefx#39578) Commit migrated from https://github.com/dotnet/corefx/commit/ba2d62a24ea8574f40c43cd27cc384f079958a0c --- .../ref/System.Diagnostics.Contracts.cs | 2 +- .../ref/System.Diagnostics.Tracing.cs | 6 +++--- .../ref/System.Runtime.Extensions.cs | 20 ++++++++++---------- .../ref/System.Runtime.Loader.cs | 6 +++--- src/libraries/System.Runtime/ref/System.Runtime.cs | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/libraries/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.cs b/src/libraries/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.cs index ba122b4..0a88ef5 100644 --- a/src/libraries/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.cs +++ b/src/libraries/System.Diagnostics.Contracts/ref/System.Diagnostics.Contracts.cs @@ -9,7 +9,7 @@ namespace System.Diagnostics.Contracts { public static partial class Contract { - public static event System.EventHandler ContractFailed { add { } remove { } } + public static event System.EventHandler? ContractFailed { add { } remove { } } [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")] [System.Diagnostics.ConditionalAttribute("DEBUG")] public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition) { } diff --git a/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs b/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs index 4a60ead..6831291 100644 --- a/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs +++ b/src/libraries/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs @@ -112,8 +112,8 @@ namespace System.Diagnostics.Tracing public abstract partial class EventListener : System.IDisposable { protected EventListener() { } - public event System.EventHandler EventSourceCreated { add { } remove { } } - public event System.EventHandler EventWritten { add { } remove { } } + public event System.EventHandler? EventSourceCreated { add { } remove { } } + public event System.EventHandler? EventWritten { add { } remove { } } public void DisableEvents(System.Diagnostics.Tracing.EventSource eventSource) { } public virtual void Dispose() { } public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level) { } @@ -160,7 +160,7 @@ namespace System.Diagnostics.Tracing public System.Guid Guid { get { throw null; } } public string Name { get { throw null; } } public System.Diagnostics.Tracing.EventSourceSettings Settings { get { throw null; } } - public event System.EventHandler EventCommandExecuted { add { } remove { } } + public event System.EventHandler? EventCommandExecuted { add { } remove { } } public void Dispose() { } protected virtual void Dispose(bool disposing) { } ~EventSource() { } diff --git a/src/libraries/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs b/src/libraries/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs index 93941c8..35a3d50 100644 --- a/src/libraries/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs +++ b/src/libraries/System.Runtime.Extensions/ref/System.Runtime.Extensions.cs @@ -26,15 +26,15 @@ namespace System public string? RelativeSearchPath { get { throw null; } } public System.AppDomainSetup SetupInformation { get { throw null; } } public bool ShadowCopyFiles { get { throw null; } } - public event System.AssemblyLoadEventHandler AssemblyLoad { add { } remove { } } - public event System.ResolveEventHandler AssemblyResolve { add { } remove { } } - public event System.EventHandler DomainUnload { add { } remove { } } - public event System.EventHandler FirstChanceException { add { } remove { } } - public event System.EventHandler ProcessExit { add { } remove { } } - public event System.ResolveEventHandler ReflectionOnlyAssemblyResolve { add { } remove { } } - public event System.ResolveEventHandler ResourceResolve { add { } remove { } } - public event System.ResolveEventHandler TypeResolve { add { } remove { } } - public event System.UnhandledExceptionEventHandler UnhandledException { add { } remove { } } + public event System.AssemblyLoadEventHandler? AssemblyLoad { add { } remove { } } + public event System.ResolveEventHandler? AssemblyResolve { add { } remove { } } + public event System.EventHandler? DomainUnload { add { } remove { } } + public event System.EventHandler? FirstChanceException { add { } remove { } } + public event System.EventHandler? ProcessExit { add { } remove { } } + public event System.ResolveEventHandler? ReflectionOnlyAssemblyResolve { add { } remove { } } + public event System.ResolveEventHandler? ResourceResolve { add { } remove { } } + public event System.ResolveEventHandler? TypeResolve { add { } remove { } } + public event System.UnhandledExceptionEventHandler? UnhandledException { add { } remove { } } [System.ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. https://go.microsoft.com/fwlink/?linkid=14202")] public void AppendPrivatePath(string? path) { } public string ApplyPolicy(string assemblyName) { throw null; } @@ -969,7 +969,7 @@ namespace System { public Progress() { } public Progress(System.Action handler) { } - public event System.EventHandler ProgressChanged { add { } remove { } } + public event System.EventHandler? ProgressChanged { add { } remove { } } protected virtual void OnReport(T value) { } void System.IProgress.Report(T value) { } } diff --git a/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs b/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs index b8e8078..4362aa6 100644 --- a/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs +++ b/src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs @@ -32,9 +32,9 @@ namespace System.Runtime.Loader public static System.Runtime.Loader.AssemblyLoadContext Default { get { throw null; } } public bool IsCollectible { get { throw null; } } public string? Name { get { throw null; } } - public event System.Func Resolving { add { } remove { } } - public event System.Func ResolvingUnmanagedDll { add { } remove { } } - public event System.Action Unloading { add { } remove { } } + public event System.Func? Resolving { add { } remove { } } + public event System.Func? ResolvingUnmanagedDll { add { } remove { } } + public event System.Action? Unloading { add { } remove { } } public System.Runtime.Loader.AssemblyLoadContext.ContextualReflectionScope EnterContextualReflection() { throw null; } public static System.Runtime.Loader.AssemblyLoadContext.ContextualReflectionScope EnterContextualReflection(System.Reflection.Assembly? activating) { throw null; } ~AssemblyLoadContext() { } diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 9fff7f6..c2d673d 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -1191,7 +1191,7 @@ namespace System public virtual string? Source { get { throw null; } set { } } public virtual string? StackTrace { get { throw null; } } public System.Reflection.MethodBase? TargetSite { get { throw null; } } - protected event System.EventHandler SerializeObjectState { add { } remove { } } + protected event System.EventHandler? SerializeObjectState { add { } remove { } } public virtual System.Exception GetBaseException() { throw null; } public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public new System.Type GetType() { throw null; } @@ -5363,7 +5363,7 @@ namespace System.Reflection public virtual System.Collections.Generic.IEnumerable Modules { get { throw null; } } public virtual bool ReflectionOnly { get { throw null; } } public virtual System.Security.SecurityRuleSet SecurityRuleSet { get { throw null; } } - public virtual event System.Reflection.ModuleResolveEventHandler ModuleResolve { add { } remove { } } + public virtual event System.Reflection.ModuleResolveEventHandler? ModuleResolve { add { } remove { } } public object? CreateInstance(string typeName) { throw null; } public object? CreateInstance(string typeName, bool ignoreCase) { throw null; } public virtual object? CreateInstance(string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object[]? args, System.Globalization.CultureInfo? culture, object[]? activationAttributes) { throw null; } @@ -8277,7 +8277,7 @@ namespace System.Threading.Tasks public static System.Threading.Tasks.TaskScheduler Default { get { throw null; } } public int Id { get { throw null; } } public virtual int MaximumConcurrencyLevel { get { throw null; } } - public static event System.EventHandler UnobservedTaskException { add { } remove { } } + public static event System.EventHandler? UnobservedTaskException { add { } remove { } } public static System.Threading.Tasks.TaskScheduler FromCurrentSynchronizationContext() { throw null; } protected abstract System.Collections.Generic.IEnumerable? GetScheduledTasks(); protected internal abstract void QueueTask(System.Threading.Tasks.Task task); -- 2.7.4