internal static int GetFormatInfoForMountPoint(string name, out string format)
{
- DriveType temp;
- return GetFormatInfoForMountPoint(name, out format, out temp);
+ return GetFormatInfoForMountPoint(name, out format, out _);
}
internal static int GetFormatInfoForMountPoint(string name, out DriveType type)
{
- string temp;
- return GetFormatInfoForMountPoint(name, out temp, out type);
+ return GetFormatInfoForMountPoint(name, out _, out type);
}
private static int GetFormatInfoForMountPoint(string name, out string format, out DriveType type)
{
// Check if we have a numeric answer or string
format = numericFormat != -1 ?
- Enum.GetName(typeof(UnixFileSystemTypes), numericFormat) :
- Marshal.PtrToStringAnsi((IntPtr)formatBuffer);
+ Enum.GetName(typeof(UnixFileSystemTypes), numericFormat) ?? string.Empty :
+ Marshal.PtrToStringAnsi((IntPtr)formatBuffer)!;
type = GetDriveType(format);
}
else
internal partial class Kernel32
{
[DllImport(Libraries.Kernel32, EntryPoint = "SetVolumeLabelW", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
- internal static extern bool SetVolumeLabel(string driveLetter, string volumeName);
+ internal static extern bool SetVolumeLabel(string driveLetter, string? volumeName);
}
}
public System.IO.DirectoryInfo RootDirectory { get { throw null; } }
public long TotalFreeSpace { get { throw null; } }
public long TotalSize { get { throw null; } }
+ [System.Diagnostics.CodeAnalysis.AllowNull]
public string VolumeLabel { get { throw null; } set { } }
public static System.IO.DriveInfo[] GetDrives() { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
{
public DriveNotFoundException() { }
protected DriveNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public DriveNotFoundException(string message) { }
- public DriveNotFoundException(string message, System.Exception innerException) { }
+ public DriveNotFoundException(string? message) { }
+ public DriveNotFoundException(string? message, System.Exception? innerException) { }
}
public enum DriveType
{
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <Nullable>enable</Nullable>
<Configurations>netcoreapp-Debug;netcoreapp-Release</Configurations>
</PropertyGroup>
<ItemGroup>
<RootNamespace>System.IO.FileSystem.DriveInfo</RootNamespace>
<AssemblyName>System.IO.FileSystem.DriveInfo</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <Nullable>enable</Nullable>
<Configurations>netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release</Configurations>
</PropertyGroup>
<ItemGroup>
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Security;
namespace System.IO
}
}
+ [AllowNull]
public string VolumeLabel
{
get
using System;
using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
}
// Null is a valid volume label.
+ [AllowNull]
public unsafe string VolumeLabel
{
get
HResult = HResults.COR_E_DIRECTORYNOTFOUND;
}
- public DriveNotFoundException(string message)
+ public DriveNotFoundException(string? message)
: base(message)
{
HResult = HResults.COR_E_DIRECTORYNOTFOUND;
}
- public DriveNotFoundException(string message, Exception innerException)
+ public DriveNotFoundException(string? message, Exception? innerException)
: base(message, innerException)
{
HResult = HResults.COR_E_DIRECTORYNOTFOUND;