Skip to content

Commit

Permalink
Annotate Microsoft.Win32.SystemEvents for nullable reference types (d…
Browse files Browse the repository at this point in the history
…otnet#1621)

* Annotate Microsoft.Win32.SystemEvents for nullable reference types

* Address PR feedback
  • Loading branch information
stephentoub authored Jan 11, 2020
1 parent ffcb1fa commit 7437cbd
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.Win32.SafeHandles;
#nullable enable
using System;
using System.Runtime.InteropServices;
using System.Text;

internal partial class Interop
{
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, EntryPoint = "GetModuleHandleW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern IntPtr GetModuleHandle(string moduleName);
internal static extern IntPtr GetModuleHandle(string? moduleName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ public enum SessionSwitchReason
public sealed partial class SystemEvents
{
internal SystemEvents() { }
public static event System.EventHandler DisplaySettingsChanged { add { } remove { } }
public static event System.EventHandler DisplaySettingsChanging { add { } remove { } }
public static event System.EventHandler EventsThreadShutdown { add { } remove { } }
public static event System.EventHandler InstalledFontsChanged { add { } remove { } }
public static event System.EventHandler? DisplaySettingsChanged { add { } remove { } }
public static event System.EventHandler? DisplaySettingsChanging { add { } remove { } }
public static event System.EventHandler? EventsThreadShutdown { add { } remove { } }
public static event System.EventHandler? InstalledFontsChanged { add { } remove { } }
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This event has been deprecated. https://go.microsoft.com/fwlink/?linkid=14202")]
public static event System.EventHandler LowMemory { add { } remove { } }
public static event System.EventHandler PaletteChanged { add { } remove { } }
public static event Microsoft.Win32.PowerModeChangedEventHandler PowerModeChanged { add { } remove { } }
public static event Microsoft.Win32.SessionEndedEventHandler SessionEnded { add { } remove { } }
public static event Microsoft.Win32.SessionEndingEventHandler SessionEnding { add { } remove { } }
public static event Microsoft.Win32.SessionSwitchEventHandler SessionSwitch { add { } remove { } }
public static event System.EventHandler TimeChanged { add { } remove { } }
public static event Microsoft.Win32.TimerElapsedEventHandler TimerElapsed { add { } remove { } }
public static event Microsoft.Win32.UserPreferenceChangedEventHandler UserPreferenceChanged { add { } remove { } }
public static event Microsoft.Win32.UserPreferenceChangingEventHandler UserPreferenceChanging { add { } remove { } }
public static event System.EventHandler? LowMemory { add { } remove { } }
public static event System.EventHandler? PaletteChanged { add { } remove { } }
public static event Microsoft.Win32.PowerModeChangedEventHandler? PowerModeChanged { add { } remove { } }
public static event Microsoft.Win32.SessionEndedEventHandler? SessionEnded { add { } remove { } }
public static event Microsoft.Win32.SessionEndingEventHandler? SessionEnding { add { } remove { } }
public static event Microsoft.Win32.SessionSwitchEventHandler? SessionSwitch { add { } remove { } }
public static event System.EventHandler? TimeChanged { add { } remove { } }
public static event Microsoft.Win32.TimerElapsedEventHandler? TimerElapsed { add { } remove { } }
public static event Microsoft.Win32.UserPreferenceChangedEventHandler? UserPreferenceChanged { add { } remove { } }
public static event Microsoft.Win32.UserPreferenceChangingEventHandler? UserPreferenceChanging { add { } remove { } }
public static System.IntPtr CreateTimer(int interval) { throw null; }
public static void InvokeOnEventsThread(System.Delegate method) { }
public static void KillTimer(System.IntPtr timerId) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
<Nullable>enable</Nullable>
<Configurations>net461-Debug;net461-Release;$(NetFrameworkCurrent)-Debug;$(NetFrameworkCurrent)-Release;netstandard2.0-Debug;netstandard2.0-Release</Configurations>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
<Nullable>enable</Nullable>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsNetStandard)' == 'true' and '$(OSGroup)' == 'AnyOS'">SR.PlatformNotSupported_SystemEvents</GeneratePlatformNotSupportedAssemblyMessage>
<Configurations>net461-Debug;net461-Release;$(NetCoreAppCurrent)-Windows_NT-Debug;$(NetCoreAppCurrent)-Windows_NT-Release;netcoreapp2.0-Windows_NT-Debug;netcoreapp2.0-Windows_NT-Release;netcoreapp3.0-Windows_NT-Debug;netcoreapp3.0-Windows_NT-Release;$(NetFrameworkCurrent)-Debug;$(NetFrameworkCurrent)-Release;netstandard2.0-Debug;netstandard2.0-Release</Configurations>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 7437cbd

Please sign in to comment.