public sealed partial class FileVersionInfo
{
internal FileVersionInfo() { }
- public string Comments { get { throw null; } }
- public string CompanyName { get { throw null; } }
+ public string? Comments { get { throw null; } }
+ public string? CompanyName { get { throw null; } }
public int FileBuildPart { get { throw null; } }
- public string FileDescription { get { throw null; } }
+ public string? FileDescription { get { throw null; } }
public int FileMajorPart { get { throw null; } }
public int FileMinorPart { get { throw null; } }
public string FileName { get { throw null; } }
public int FilePrivatePart { get { throw null; } }
- public string FileVersion { get { throw null; } }
- public string InternalName { get { throw null; } }
+ public string? FileVersion { get { throw null; } }
+ public string? InternalName { get { throw null; } }
public bool IsDebug { get { throw null; } }
public bool IsPatched { get { throw null; } }
public bool IsPreRelease { get { throw null; } }
public bool IsPrivateBuild { get { throw null; } }
public bool IsSpecialBuild { get { throw null; } }
- public string Language { get { throw null; } }
- public string LegalCopyright { get { throw null; } }
- public string LegalTrademarks { get { throw null; } }
- public string OriginalFilename { get { throw null; } }
- public string PrivateBuild { get { throw null; } }
+ public string? Language { get { throw null; } }
+ public string? LegalCopyright { get { throw null; } }
+ public string? LegalTrademarks { get { throw null; } }
+ public string? OriginalFilename { get { throw null; } }
+ public string? PrivateBuild { get { throw null; } }
public int ProductBuildPart { get { throw null; } }
public int ProductMajorPart { get { throw null; } }
public int ProductMinorPart { get { throw null; } }
- public string ProductName { get { throw null; } }
+ public string? ProductName { get { throw null; } }
public int ProductPrivatePart { get { throw null; } }
- public string ProductVersion { get { throw null; } }
- public string SpecialBuild { get { throw null; } }
+ public string? ProductVersion { get { throw null; } }
+ public string? SpecialBuild { get { throw null; } }
public static System.Diagnostics.FileVersionInfo GetVersionInfo(string fileName) { throw null; }
public override string ToString() { throw null; }
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
+ <Nullable>enable</Nullable>
<Configurations>$(NetCoreAppCurrent)-Debug;$(NetCoreAppCurrent)-Release</Configurations>
</PropertyGroup>
<ItemGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);CS1573</NoWarn>
<Configurations>$(NetCoreAppCurrent)-Unix-Debug;$(NetCoreAppCurrent)-Unix-Release;$(NetCoreAppCurrent)-Windows_NT-Debug;$(NetCoreAppCurrent)-Windows_NT-Release</Configurations>
+ <Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System\Diagnostics\FileVersionInfo.cs" />
}
/// <summary>Parses the version into its constituent parts.</summary>
- private static void ParseVersion(string versionString, out int major, out int minor, out int build, out int priv)
+ private static void ParseVersion(string? versionString, out int major, out int minor, out int build, out int priv)
{
// Relatively-forgiving parsing of a version:
// - If there are more than four parts (separated by periods), all results are deemed 0
// - Whitespace is treated like any other non-digit character and thus isn't ignored.
// - Each component is parsed as a ushort, allowing for overflow.
- string[] parts = versionString.Split(s_versionSeparators);
major = minor = build = priv = 0;
- if (parts.Length <= 4)
+
+ if (versionString != null)
{
- bool endedEarly;
- if (parts.Length > 0)
+ string[] parts = versionString.Split(s_versionSeparators);
+ if (parts.Length <= 4 && parts.Length > 0)
{
- major = ParseUInt16UntilNonDigit(parts[0], out endedEarly);
+ major = ParseUInt16UntilNonDigit(parts[0], out bool endedEarly);
if (!endedEarly && parts.Length > 1)
{
minor = ParseUInt16UntilNonDigit(parts[1], out endedEarly);
build = ParseUInt16UntilNonDigit(parts[2], out endedEarly);
if (!endedEarly && parts.Length > 3)
{
- priv = ParseUInt16UntilNonDigit(parts[3], out endedEarly);
+ priv = ParseUInt16UntilNonDigit(parts[3], out _);
}
}
}
/// <param name="reader">The metadata reader.</param>
/// <param name="attr">The attribute.</param>
/// <param name="value">The value parsed from the attribute, if it could be retrieved; otherwise, the value is left unmodified.</param>
- private static void GetStringAttributeArgumentValue(MetadataReader reader, CustomAttribute attr, ref string value)
+ private static void GetStringAttributeArgumentValue(MetadataReader reader, CustomAttribute attr, ref string? value)
{
EntityHandle ctorHandle = attr.Constructor;
BlobHandle signature;
using System.Globalization;
using System.Runtime.InteropServices;
-using System.Text;
namespace System.Diagnostics
{
{
if (memRef != IntPtr.Zero)
{
- return Marshal.PtrToStringUni(memRef);
+ return Marshal.PtrToStringUni(memRef)!;
}
}
{
private readonly string _fileName;
- private string _companyName;
- private string _fileDescription;
- private string _fileVersion;
- private string _internalName;
- private string _legalCopyright;
- private string _originalFilename;
- private string _productName;
- private string _productVersion;
- private string _comments;
- private string _legalTrademarks;
- private string _privateBuild;
- private string _specialBuild;
- private string _language;
+ private string? _companyName;
+ private string? _fileDescription;
+ private string? _fileVersion;
+ private string? _internalName;
+ private string? _legalCopyright;
+ private string? _originalFilename;
+ private string? _productName;
+ private string? _productVersion;
+ private string? _comments;
+ private string? _legalTrademarks;
+ private string? _privateBuild;
+ private string? _specialBuild;
+ private string? _language;
private int _fileMajor;
private int _fileMinor;
private int _fileBuild;
/// <summary>
/// Gets the comments associated with the file.
/// </summary>
- public string Comments
+ public string? Comments
{
get { return _comments; }
}
/// <summary>
/// Gets the name of the company that produced the file.
/// </summary>
- public string CompanyName
+ public string? CompanyName
{
get { return _companyName; }
}
/// <summary>
/// Gets the description of the file.
/// </summary>
- public string FileDescription
+ public string? FileDescription
{
get { return _fileDescription; }
}
/// <summary>
/// Gets the file version number.
/// </summary>
- public string FileVersion
+ public string? FileVersion
{
get { return _fileVersion; }
}
/// <summary>
/// Gets the internal name of the file, if one exists.
/// </summary>
- public string InternalName
+ public string? InternalName
{
get { return _internalName; }
}
/// <summary>
/// Gets the default language string for the version info block.
/// </summary>
- public string Language
+ public string? Language
{
get { return _language; }
}
/// <summary>
/// Gets all copyright notices that apply to the specified file.
/// </summary>
- public string LegalCopyright
+ public string? LegalCopyright
{
get { return _legalCopyright; }
}
/// <summary>
/// Gets the trademarks and registered trademarks that apply to the file.
/// </summary>
- public string LegalTrademarks
+ public string? LegalTrademarks
{
get { return _legalTrademarks; }
}
/// <summary>
/// Gets the name the file was created with.
/// </summary>
- public string OriginalFilename
+ public string? OriginalFilename
{
get { return _originalFilename; }
}
/// <summary>
/// Gets information about a private version of the file.
/// </summary>
- public string PrivateBuild
+ public string? PrivateBuild
{
get { return _privateBuild; }
}
/// <summary>
/// Gets the name of the product this file is distributed with.
/// </summary>
- public string ProductName
+ public string? ProductName
{
get { return _productName; }
}
/// <summary>
/// Gets the version of the product this file is distributed with.
/// </summary>
- public string ProductVersion
+ public string? ProductVersion
{
get { return _productVersion; }
}
/// <summary>
/// Gets the special build information for the file.
/// </summary>
- public string SpecialBuild
+ public string? SpecialBuild
{
get { return _specialBuild; }
}