Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nullability to file used in autorest #23544

Merged
merged 5 commits into from
Aug 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#nullable enable

using System;
using System.Reflection;
using System.Runtime.InteropServices;
Expand All @@ -12,7 +14,7 @@ internal static class HttpMessageUtilities
{
internal static readonly string PlatformInformation = $"({RuntimeInformation.FrameworkDescription}; {RuntimeInformation.OSDescription})";

private static string GetUserAgentName(string componentName, string componentVersion, string applicationId)
private static string GetUserAgentName(string componentName, string componentVersion, string? applicationId)
{
string result;
if (applicationId != null)
Expand All @@ -30,9 +32,9 @@ internal static string GetUserAgentName(object source, ClientOptions options)
{
const string PackagePrefix = "Azure.";

Assembly assembly = source.GetType().Assembly;
Assembly assembly = source.GetType().Assembly!;

AssemblyInformationalVersionAttribute versionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
AssemblyInformationalVersionAttribute? versionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
if (versionAttribute == null)
{
throw new InvalidOperationException($"{nameof(AssemblyInformationalVersionAttribute)} is required on client SDK assembly '{assembly.FullName}' (inferred from the use of options type '{options.GetType().FullName}').");
Expand Down