diff --git a/.editorconfig b/.editorconfig index 767ae4a99..538d72491 100644 --- a/.editorconfig +++ b/.editorconfig @@ -152,12 +152,58 @@ dotnet_diagnostic.MEF006.severity = silent dotnet_diagnostic.IDE2003.severity = silent #cleared null error types +dotnet_diagnostic.CS8597.severity = error +dotnet_diagnostic.CS8605.severity = error +dotnet_diagnostic.CS8606.severity = error +dotnet_diagnostic.CS8607.severity = error +dotnet_diagnostic.CS8608.severity = error +dotnet_diagnostic.CS8609.severity = error +dotnet_diagnostic.CS8610.severity = error +dotnet_diagnostic.CS8611.severity = error dotnet_diagnostic.CS8612.severity = error +dotnet_diagnostic.CS8613.severity = error +dotnet_diagnostic.CS8614.severity = error +dotnet_diagnostic.CS8615.severity = error +dotnet_diagnostic.CS8621.severity = error dotnet_diagnostic.CS8622.severity = error +dotnet_diagnostic.CS8624.severity = error +dotnet_diagnostic.CS8633.severity = error +dotnet_diagnostic.CS8634.severity = error +dotnet_diagnostic.CS8643.severity = error +dotnet_diagnostic.CS8644.severity = error +dotnet_diagnostic.CS8645.severity = error +dotnet_diagnostic.CS8655.severity = error +dotnet_diagnostic.CS8667.severity = error +dotnet_diagnostic.CS8670.severity = error dotnet_diagnostic.CS8714.severity = error dotnet_diagnostic.CS8762.severity = error +dotnet_diagnostic.CS8763.severity = error +dotnet_diagnostic.CS8764.severity = error dotnet_diagnostic.CS8765.severity = error dotnet_diagnostic.CS8766.severity = error dotnet_diagnostic.CS8767.severity = error dotnet_diagnostic.CS8768.severity = error dotnet_diagnostic.CS8769.severity = error +dotnet_diagnostic.CS8770.severity = error +dotnet_diagnostic.CS8773.severity = error +dotnet_diagnostic.CS8774.severity = error +dotnet_diagnostic.CS8775.severity = error +dotnet_diagnostic.CS8776.severity = error +dotnet_diagnostic.CS8775.severity = error +dotnet_diagnostic.CS8777.severity = error + +#nullable error types still not cleaned up +dotnet_diagnostic.CS8600.severity = warning +dotnet_diagnostic.CS8601.severity = warning +dotnet_diagnostic.CS8602.severity = warning +dotnet_diagnostic.CS8603.severity = warning +dotnet_diagnostic.CS8604.severity = warning +dotnet_diagnostic.CS8605.severity = warning +dotnet_diagnostic.CS8615.severity = warning +dotnet_diagnostic.CS8617.severity = warning +dotnet_diagnostic.CS8618.severity = warning +dotnet_diagnostic.CS8619.severity = warning +dotnet_diagnostic.CS8620.severity = warning +dotnet_diagnostic.CS8625.severity = warning +dotnet_diagnostic.CS8629.severity = warning +dotnet_diagnostic.CS8631.severity = warning diff --git a/ICSharpCode.BamlDecompiler/BamlDecompilerSettings.cs b/ICSharpCode.BamlDecompiler/BamlDecompilerSettings.cs index 4f0891560..b8ce8b69e 100644 --- a/ICSharpCode.BamlDecompiler/BamlDecompilerSettings.cs +++ b/ICSharpCode.BamlDecompiler/BamlDecompilerSettings.cs @@ -37,9 +37,9 @@ namespace ICSharpCode.BamlDecompiler } } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler? PropertyChanged; - protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) { if (PropertyChanged != null) { diff --git a/ICSharpCode.BamlDecompiler/ICSharpCode.BamlDecompiler.csproj b/ICSharpCode.BamlDecompiler/ICSharpCode.BamlDecompiler.csproj index cd022af4b..9acb0192b 100644 --- a/ICSharpCode.BamlDecompiler/ICSharpCode.BamlDecompiler.csproj +++ b/ICSharpCode.BamlDecompiler/ICSharpCode.BamlDecompiler.csproj @@ -35,6 +35,7 @@ <DebugSymbols>true</DebugSymbols> <EmbedUntrackedSources>true</EmbedUntrackedSources> <PublishRepositoryUrl>true</PublishRepositoryUrl> + <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> diff --git a/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj b/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj index f5d58901f..3c3e0fa1d 100644 --- a/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj +++ b/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj @@ -6,6 +6,7 @@ <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <RootNamespace>ICSharpCode.Decompiler.PowerShell</RootNamespace> <LangVersion>8.0</LangVersion> + <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> diff --git a/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs b/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs index b9e619830..b1e074e0e 100644 --- a/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs @@ -71,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler public AssemblyReferenceClassifier AssemblyReferenceClassifier { get; } - public IDebugInfoProvider DebugInfoProvider { get; } + public IDebugInfoProvider? DebugInfoProvider { get; } /// <summary> /// The MSBuild ProjectGuid to use for the new project. @@ -106,9 +106,9 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler public WholeProjectDecompiler( DecompilerSettings settings, IAssemblyResolver assemblyResolver, - IProjectFileWriter projectWriter, - AssemblyReferenceClassifier assemblyReferenceClassifier, - IDebugInfoProvider debugInfoProvider) + IProjectFileWriter? projectWriter, + AssemblyReferenceClassifier? assemblyReferenceClassifier, + IDebugInfoProvider? debugInfoProvider) : this(settings, Guid.NewGuid(), assemblyResolver, projectWriter, assemblyReferenceClassifier, debugInfoProvider) { } @@ -117,9 +117,9 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler DecompilerSettings settings, Guid projectGuid, IAssemblyResolver assemblyResolver, - IProjectFileWriter projectWriter, - AssemblyReferenceClassifier assemblyReferenceClassifier, - IDebugInfoProvider debugInfoProvider) + IProjectFileWriter? projectWriter, + AssemblyReferenceClassifier? assemblyReferenceClassifier, + IDebugInfoProvider? debugInfoProvider) { Settings = settings ?? throw new ArgumentNullException(nameof(settings)); ProjectGuid = projectGuid; diff --git a/ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs b/ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs index 1a7d16695..5b5d68f31 100644 --- a/ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs +++ b/ICSharpCode.Decompiler/Documentation/XmlDocLoader.cs @@ -31,8 +31,8 @@ namespace ICSharpCode.Decompiler.Documentation /// </summary> public static class XmlDocLoader { - static readonly Lazy<XmlDocumentationProvider> mscorlibDocumentation = new Lazy<XmlDocumentationProvider>(LoadMscorlibDocumentation); - static readonly ConditionalWeakTable<MetadataFile, XmlDocumentationProvider> cache = new(); + static readonly Lazy<XmlDocumentationProvider?> mscorlibDocumentation = new Lazy<XmlDocumentationProvider?>(LoadMscorlibDocumentation); + static readonly ConditionalWeakTable<MetadataFile, XmlDocumentationProvider?> cache = new(); static XmlDocumentationProvider? LoadMscorlibDocumentation() { @@ -44,11 +44,11 @@ namespace ICSharpCode.Decompiler.Documentation return null; } - public static XmlDocumentationProvider MscorlibDocumentation { + public static XmlDocumentationProvider? MscorlibDocumentation { get { return mscorlibDocumentation.Value; } } - public static XmlDocumentationProvider LoadDocumentation(MetadataFile module) + public static XmlDocumentationProvider? LoadDocumentation(MetadataFile module) { if (module == null) throw new ArgumentNullException(nameof(module)); @@ -56,7 +56,7 @@ namespace ICSharpCode.Decompiler.Documentation { if (!cache.TryGetValue(module, out XmlDocumentationProvider? xmlDoc)) { - string xmlDocFile = LookupLocalizedXmlDoc(module.FileName); + string? xmlDocFile = LookupLocalizedXmlDoc(module.FileName); if (xmlDocFile == null) { xmlDocFile = FindXmlDocumentation(Path.GetFileName(module.FileName), module.GetRuntime()); @@ -79,9 +79,9 @@ namespace ICSharpCode.Decompiler.Documentation static readonly string referenceAssembliesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"Reference Assemblies\Microsoft\\Framework"); static readonly string frameworkPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), @"Microsoft.NET\Framework"); - static string FindXmlDocumentation(string assemblyFileName, TargetRuntime runtime) + static string? FindXmlDocumentation(string assemblyFileName, TargetRuntime runtime) { - string fileName; + string? fileName; switch (runtime) { case TargetRuntime.Net_1_0: diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index 1f9500aa8..bc037ace5 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -32,7 +32,6 @@ <SignAssembly>True</SignAssembly> <AssemblyOriginatorKeyFile>ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile> <NoWarn>1701;1702;1591;1573</NoWarn> - <WarningsAsErrors>nullable</WarningsAsErrors> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <DebugType>embedded</DebugType> diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs index 3261dbb8c..960095875 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs @@ -447,7 +447,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms return delegateType; } - (Func<ILInstruction>?, IType) ConvertArrayIndex(CallInstruction invocation) + (Func<ILInstruction?>?, IType) ConvertArrayIndex(CallInstruction invocation) { if (invocation.Arguments.Count != 2) return (null, SpecialType.UnknownType); diff --git a/ICSharpCode.Decompiler/Semantics/OperatorResolveResult.cs b/ICSharpCode.Decompiler/Semantics/OperatorResolveResult.cs index cd54d315e..45f83eb1e 100644 --- a/ICSharpCode.Decompiler/Semantics/OperatorResolveResult.cs +++ b/ICSharpCode.Decompiler/Semantics/OperatorResolveResult.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.Semantics public class OperatorResolveResult : ResolveResult { readonly ExpressionType operatorType; - readonly IMethod userDefinedOperatorMethod; + readonly IMethod? userDefinedOperatorMethod; readonly IList<ResolveResult> operands; readonly bool isLiftedOperator; @@ -43,7 +43,7 @@ namespace ICSharpCode.Decompiler.Semantics this.operands = operands; } - public OperatorResolveResult(IType resultType, ExpressionType operatorType, IMethod userDefinedOperatorMethod, bool isLiftedOperator, IList<ResolveResult> operands) + public OperatorResolveResult(IType resultType, ExpressionType operatorType, IMethod? userDefinedOperatorMethod, bool isLiftedOperator, IList<ResolveResult> operands) : base(resultType) { if (operands == null) diff --git a/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj b/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj index ca25d2eef..179d463c9 100644 --- a/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj +++ b/ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj @@ -8,7 +8,7 @@ <IsPackable>true</IsPackable> <PackAsTool>true</PackAsTool> <InvariantGlobalization>true</InvariantGlobalization> - + <Nullable>enable</Nullable> <NeutralLanguage>en-US</NeutralLanguage> <GenerateAssemblyVersionAttribute>False</GenerateAssemblyVersionAttribute> <GenerateAssemblyFileVersionAttribute>False</GenerateAssemblyFileVersionAttribute> diff --git a/ICSharpCode.ILSpyCmd/ValidationAttributes.cs b/ICSharpCode.ILSpyCmd/ValidationAttributes.cs index 7ddd2ce80..f9d34db37 100644 --- a/ICSharpCode.ILSpyCmd/ValidationAttributes.cs +++ b/ICSharpCode.ILSpyCmd/ValidationAttributes.cs @@ -14,7 +14,7 @@ namespace ICSharpCode.ILSpyCmd { } - protected override ValidationResult IsValid(object value, ValidationContext context) + protected override ValidationResult? IsValid(object? value, ValidationContext context) { if (value is ILSpyCmdProgram obj) { @@ -30,7 +30,7 @@ namespace ICSharpCode.ILSpyCmd [AttributeUsage(AttributeTargets.Property)] public sealed class FileExistsOrNullAttribute : ValidationAttribute { - protected override ValidationResult IsValid(object value, ValidationContext validationContext) + protected override ValidationResult? IsValid(object? value, ValidationContext validationContext) { var path = value as string; if (string.IsNullOrEmpty(path)) @@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpyCmd [AttributeUsage(AttributeTargets.Property)] public sealed class FilesExistAttribute : ValidationAttribute { - protected override ValidationResult IsValid(object value, ValidationContext validationContext) + protected override ValidationResult? IsValid(object? value, ValidationContext validationContext) { switch (value) { @@ -65,7 +65,7 @@ namespace ICSharpCode.ILSpyCmd { foreach (string path in paths) { - ValidationResult result = ValidatePath(path); + ValidationResult? result = ValidatePath(path); if (result != ValidationResult.Success) return result; } @@ -75,7 +75,7 @@ namespace ICSharpCode.ILSpyCmd return new ValidationResult($"File '{value}' does not exist!"); } - ValidationResult ValidatePath(string path) + ValidationResult? ValidatePath(string path) { if (!string.IsNullOrWhiteSpace(path)) { diff --git a/ICSharpCode.ILSpyX/Analyzers/AnalyzerHelpers.cs b/ICSharpCode.ILSpyX/Analyzers/AnalyzerHelpers.cs index 4c5217ef6..25b9ebae7 100644 --- a/ICSharpCode.ILSpyX/Analyzers/AnalyzerHelpers.cs +++ b/ICSharpCode.ILSpyX/Analyzers/AnalyzerHelpers.cs @@ -54,7 +54,7 @@ namespace ICSharpCode.ILSpyX.Analyzers switch (customAttribute.Parent.Kind) { case HandleKind.MethodDefinition: - IMethod parent = (IMethod)ts.MainModule.ResolveEntity(customAttribute.Parent); + IMethod? parent = (IMethod?)ts.MainModule.ResolveEntity(customAttribute.Parent); return parent?.AccessorOwner ?? parent; case HandleKind.FieldDefinition: case HandleKind.PropertyDefinition: diff --git a/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj b/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj index bcea038e2..41e03236d 100644 --- a/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj +++ b/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj @@ -4,8 +4,7 @@ <TargetFramework>net8.0</TargetFramework> <Nullable>enable</Nullable> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <WarningsAsErrors>nullable</WarningsAsErrors> - + <Nullable>enable</Nullable> <SignAssembly>True</SignAssembly> <AssemblyOriginatorKeyFile>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile> diff --git a/ICSharpCode.ILSpyX/TreeView/TreeTraversal.cs b/ICSharpCode.ILSpyX/TreeView/TreeTraversal.cs index 25034616d..e365780ea 100644 --- a/ICSharpCode.ILSpyX/TreeView/TreeTraversal.cs +++ b/ICSharpCode.ILSpyX/TreeView/TreeTraversal.cs @@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpyX.TreeView /// <param name="input">The root elements of the forest.</param> /// <param name="recursion">The function that gets the children of an element.</param> /// <returns>Iterator that enumerates the tree structure in pre-order.</returns> - public static IEnumerable<T> PreOrder<T>(IEnumerable<T> input, Func<T, IEnumerable<T>> recursion) + public static IEnumerable<T> PreOrder<T>(IEnumerable<T> input, Func<T, IEnumerable<T>?> recursion) { Stack<IEnumerator<T>> stack = new Stack<IEnumerator<T>>(); try @@ -55,7 +55,7 @@ namespace ICSharpCode.ILSpyX.TreeView { T element = stack.Peek().Current; yield return element; - IEnumerable<T> children = recursion(element); + IEnumerable<T>? children = recursion(element); if (children != null) { stack.Push(children.GetEnumerator()); diff --git a/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj b/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj index d92e79c75..d7c1e6b3e 100644 --- a/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj +++ b/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj @@ -4,6 +4,7 @@ <PropertyGroup> <IsWindowsX64 Condition="$([MSBuild]::IsOsPlatform('Windows')) And $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == X64">true</IsWindowsX64> <IsWindowsARM64 Condition="$([MSBuild]::IsOsPlatform('Windows')) And $([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) == ARM64">true</IsWindowsARM64> + <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup> diff --git a/ILSpy.BamlDecompiler/BamlResourceEntryNode.cs b/ILSpy.BamlDecompiler/BamlResourceEntryNode.cs index 788b32ce1..7a573a4e2 100644 --- a/ILSpy.BamlDecompiler/BamlResourceEntryNode.cs +++ b/ILSpy.BamlDecompiler/BamlResourceEntryNode.cs @@ -33,13 +33,13 @@ namespace ILSpy.BamlDecompiler { public sealed class BamlResourceEntryNode : ResourceEntryNode { - public BamlResourceEntryNode(string key, Func<Stream> data) : base(key, data) + public BamlResourceEntryNode(string key, Func<Stream?> data) : base(key, data) { } public override bool View(TabPageModel tabPage) { - IHighlightingDefinition highlighting = null; + IHighlightingDefinition? highlighting = null; tabPage.SupportsLanguageSwitching = false; tabPage.ShowTextView(textView => textView.RunWithCancellation( diff --git a/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj b/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj index 63950dda4..7ac2ce92b 100644 --- a/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj +++ b/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj @@ -9,6 +9,7 @@ <BaseAddress>6488064</BaseAddress> <UseWpf>true</UseWpf> <EnableWindowsTargeting>true</EnableWindowsTargeting> + <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> diff --git a/ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj b/ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj index dfe925ddd..dc007bde0 100644 --- a/ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj +++ b/ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj @@ -11,6 +11,7 @@ <UseWpf>true</UseWpf> <IsPackable>false</IsPackable> <EnableWindowsTargeting>true</EnableWindowsTargeting> + <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> diff --git a/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs b/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs index fbe046ea4..8b8ae256e 100644 --- a/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs +++ b/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs @@ -114,9 +114,9 @@ namespace ICSharpCode.ILSpy.ReadyToRun } } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler? PropertyChanged; - protected virtual void OnPropertyChanged(string propertyName) + protected virtual void OnPropertyChanged(string? propertyName) { if (PropertyChanged != null) { diff --git a/ILSpy.Tests/ILSpy.Tests.csproj b/ILSpy.Tests/ILSpy.Tests.csproj index 0f44621f6..2f31cb000 100644 --- a/ILSpy.Tests/ILSpy.Tests.csproj +++ b/ILSpy.Tests/ILSpy.Tests.csproj @@ -17,6 +17,7 @@ <SignAssembly>True</SignAssembly> <AssemblyOriginatorKeyFile>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> diff --git a/ILSpy/Controls/CustomDialog.cs b/ILSpy/Controls/CustomDialog.cs index 994bedffc..036aff29a 100644 --- a/ILSpy/Controls/CustomDialog.cs +++ b/ILSpy/Controls/CustomDialog.cs @@ -113,9 +113,9 @@ namespace ICSharpCode.ILSpy.Controls } } - void ButtonClick(object sender, EventArgs e) + void ButtonClick(object? sender, EventArgs e) { - result = (int)((Control)sender).Tag; + result = ((int?)(sender as Control)?.Tag) ?? -1; this.Close(); } diff --git a/ILSpy/Docking/DockWorkspace.cs b/ILSpy/Docking/DockWorkspace.cs index 59100a4d3..eb8323adc 100644 --- a/ILSpy/Docking/DockWorkspace.cs +++ b/ILSpy/Docking/DockWorkspace.cs @@ -82,7 +82,7 @@ namespace ICSharpCode.ILSpy.Docking } } - private void Documents_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + private void Documents_CollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) { var collection = (PaneCollection<TabPageModel>)sender; if (e.Action == NotifyCollectionChangedAction.Add) diff --git a/ILSpy/TreeNodes/AssemblyListTreeNode.cs b/ILSpy/TreeNodes/AssemblyListTreeNode.cs index 5dc676797..9ffe3fdf0 100644 --- a/ILSpy/TreeNodes/AssemblyListTreeNode.cs +++ b/ILSpy/TreeNodes/AssemblyListTreeNode.cs @@ -203,7 +203,9 @@ namespace ICSharpCode.ILSpy.TreeNodes } return null; - static SharpTreeNodeCollection? ExpandAndGetChildren(SharpTreeNode node) + + + static SharpTreeNodeCollection ExpandAndGetChildren(SharpTreeNode node) { if (node is not PackageFolderTreeNode) return null; diff --git a/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs index 640d373e3..393b3198d 100644 --- a/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs @@ -50,7 +50,7 @@ namespace ICSharpCode.ILSpy.TreeNodes sealed class CursorResourceEntryNode : ResourceEntryNode { - public CursorResourceEntryNode(string key, Func<Stream> openStream) + public CursorResourceEntryNode(string key, Func<Stream?> openStream) : base(key, openStream) { } diff --git a/TestPlugin/CustomOptionPage.xaml.cs b/TestPlugin/CustomOptionPage.xaml.cs index 9c38af296..1c16be47f 100644 --- a/TestPlugin/CustomOptionPage.xaml.cs +++ b/TestPlugin/CustomOptionPage.xaml.cs @@ -86,7 +86,7 @@ namespace TestPlugin } } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler? PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { diff --git a/TestPlugin/MainMenuCommand.cs b/TestPlugin/MainMenuCommand.cs index bb4a041f8..3832716c2 100644 --- a/TestPlugin/MainMenuCommand.cs +++ b/TestPlugin/MainMenuCommand.cs @@ -21,7 +21,7 @@ namespace TestPlugin [PartCreationPolicy(CreationPolicy.Shared)] public class UnloadAllAssembliesCommand : SimpleCommand { - public override void Execute(object parameter) + public override void Execute(object? parameter) { foreach (var loadedAssembly in MainWindow.Instance.CurrentAssemblyList.GetAssemblies()) { diff --git a/TestPlugin/TestPlugin.csproj b/TestPlugin/TestPlugin.csproj index c527fbcae..fc7d4b508 100644 --- a/TestPlugin/TestPlugin.csproj +++ b/TestPlugin/TestPlugin.csproj @@ -5,6 +5,7 @@ <AssemblyName>Test.Plugin</AssemblyName> <UseWpf>true</UseWpf> <EnableWindowsTargeting>true</EnableWindowsTargeting> + <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)' == 'Debug'">