Skip to content

Commit

Permalink
add nullability to file used in autorest (#23544)
Browse files Browse the repository at this point in the history
* update namespace for model types
update armclient to add new mgmttelemetrypolicy

* remove props change and update api

* use set value

* enable nullable
  • Loading branch information
m-nash authored Aug 26, 2021
1 parent 7290878 commit 106aabf
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit 106aabf

Please sign in to comment.