Skip to content

NetCore warning removal #3

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

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Azure.PowerShell.Netcore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Aks.Netcore", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Strategies.Netcore", "src\ResourceManager\Common\Commands.Common.Strategies\Common.Strategies.Netcore.csproj", "{77492655-0086-49E8-B941-7C3E9D5448E9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Common.Compute.Netcore", "src\Common\Commands.Common.Compute\Commands.Common.Compute.Netcore.csproj", "{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Compute.Netcore", "src\Common\Commands.Common.Compute\Common.Compute.Netcore.csproj", "{5E5D1F8E-92C8-40EB-AABA-DFD12AFD6D0A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.AnalysisServices.Netcore", "src\ResourceManager\AnalysisServices\Commands.AnalysisServices\Commands.AnalysisServices.Netcore.csproj", "{C348F9F1-3CF4-4B98-91C7-C13C0386DBC7}"
EndProject
Expand Down
3 changes: 3 additions & 0 deletions Azure.PowerShell.Netcore.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IncludeWarningsInSwea/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion src/Azure.PowerShell.Netcore.Test.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Profile.Test.Netco
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.ResourceManager.ScenarioTests.Netcore", "ResourceManager\Common\Commands.ScenarioTests.ResourceManager.Common\Common.ResourceManager.ScenarioTests.Netcore.csproj", "{624FE5CE-0F46-4A0A-9A1B-54D5724B7F96}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Commands.Common.Tests.Netcore", "Common\Commands.Common.Tests\Commands.Common.Tests.Netcore.csproj", "{B0EF35E9-2D7A-4AAE-8A1A-728B6CC8524B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Tests.Netcore", "Common\Commands.Common.Tests\Common.Tests.Netcore.csproj", "{B0EF35E9-2D7A-4AAE-8A1A-728B6CC8524B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.Authentication.Abstractions.Netcore", "Common\Commands.Common.Authentication.Abstractions\Common.Authentication.Abstractions.Netcore.csproj", "{5C1894D4-47AA-4B77-AF92-33B40CC28C31}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public override bool Equals(object obj)
{
return false;
}
else
{
return string.Equals(anotherAccount.Id, Id, StringComparison.InvariantCultureIgnoreCase);
}
return string.Equals(anotherAccount.Id, Id, StringComparison.InvariantCultureIgnoreCase);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public static AzureRmProfileProvider Instance
}
catch (LockRecursionException lockException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockReadRecursion, lockException);
throw new InvalidOperationException(Properties.Resources.ProfileLockReadRecursion, lockException);
}
catch (ObjectDisposedException disposedException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockReadDisposed, disposedException);
throw new InvalidOperationException(Properties.Resources.ProfileLockReadDisposed, disposedException);
}
}
}
Expand Down Expand Up @@ -86,11 +86,11 @@ public static void SetInstance(Func<AzureRmProfileProvider> provider, bool overw
}
catch (LockRecursionException lockException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockWriteRecursion, lockException);
throw new InvalidOperationException(Properties.Resources.ProfileLockWriteRecursion, lockException);
}
catch (ObjectDisposedException disposedException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockWriteDisposed, disposedException);
throw new InvalidOperationException(Properties.Resources.ProfileLockWriteDisposed, disposedException);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public static AzureSMProfileProvider Instance
}
catch (LockRecursionException lockException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockReadRecursion, lockException);
throw new InvalidOperationException(Properties.Resources.ProfileLockReadRecursion, lockException);
}
catch (ObjectDisposedException disposedException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockReadDisposed, disposedException);
throw new InvalidOperationException(Properties.Resources.ProfileLockReadDisposed, disposedException);
}
}
}
Expand Down Expand Up @@ -84,11 +84,11 @@ public static void SetInstance(Func<AzureSMProfileProvider> provider, bool overw
}
catch (LockRecursionException lockException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockWriteRecursion, lockException);
throw new InvalidOperationException(Properties.Resources.ProfileLockWriteRecursion, lockException);
}
catch (ObjectDisposedException disposedException)
{
throw new InvalidOperationException(Abstractions.Properties.Resources.ProfileLockWriteDisposed, disposedException);
throw new InvalidOperationException(Properties.Resources.ProfileLockWriteDisposed, disposedException);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public override bool Equals(object obj)
{
var other = obj as ComponentKey;
return other != null
&& this.Equals(other);
&& Equals(other);
}

public int CompareTo(ComponentKey other)
Expand All @@ -303,15 +303,15 @@ public int CompareTo(ComponentKey other)
return 1;
}

var stringCompare = this.Name.ToLowerInvariant().CompareTo(other.Name.ToLowerInvariant());
return (stringCompare != 0 ? stringCompare : this.Type.CompareTo(other.Type));
var stringCompare = Name.ToLowerInvariant().CompareTo(other.Name.ToLowerInvariant());
return stringCompare != 0 ? stringCompare : Type.CompareTo(other.Type);
}

public bool Equals(ComponentKey other)
{
return other != null
&& string.Equals(this.Name, other.Name, StringComparison.OrdinalIgnoreCase)
&& string.Equals(this.Type, other.Type, StringComparison.OrdinalIgnoreCase);
&& string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase)
&& string.Equals(Type, other.Type, StringComparison.OrdinalIgnoreCase);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ public override bool Equals(object obj)
{
return false;
}
else
{
return anotherSubscription.Id == Id;
}
return anotherSubscription.Id == Id;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,30 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DelaySign>false</DelaySign>
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<SignAssembly>True</SignAssembly>
<DelaySign>True</DelaySign>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
<DefineConstants>TRACE;RELEASE;NETSTANDARD;SIGN</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
<DelaySign>false</DelaySign>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.4.0" />
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Security.SecureString" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DesignTime>true</DesignTime>
<AutoGen>true</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,24 +189,18 @@ public X509Certificate2 GetCertificate(string thumbprint)
{
return null;
}
else
if (string.IsNullOrEmpty(thumbprint))
{
if (string.IsNullOrEmpty(thumbprint))
{
throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, "certificate thumbprint"));
}
throw new ArgumentException(string.Format(Resources.InvalidOrEmptyArgumentMessage, "certificate thumbprint"));
}

X509Certificate2Collection certificates;
if (TryFindCertificatesInStore(thumbprint, StoreLocation.CurrentUser, out certificates) ||
TryFindCertificatesInStore(thumbprint, StoreLocation.LocalMachine, out certificates))
{
return certificates[0];
}
else
{
throw new ArgumentException(string.Format(Resources.CertificateNotFoundInStore, thumbprint));
}
X509Certificate2Collection certificates;
if (TryFindCertificatesInStore(thumbprint, StoreLocation.CurrentUser, out certificates) ||
TryFindCertificatesInStore(thumbprint, StoreLocation.LocalMachine, out certificates))
{
return certificates[0];
}
throw new ArgumentException(string.Format(Resources.CertificateNotFoundInStore, thumbprint));
}

/// <summary>
Expand All @@ -220,7 +214,7 @@ public void AddCertificate(X509Certificate2 certificate)
throw new ArgumentException(Resources.InvalidCertificate);
}

X509StoreWrapper(StoreName.My, StoreLocation.CurrentUser, (store) =>
X509StoreWrapper(StoreName.My, StoreLocation.CurrentUser, store =>
{
store.Open(OpenFlags.ReadWrite);
store.Add(certificate);
Expand All @@ -238,7 +232,7 @@ public void RemoveCertificate(string thumbprint)
var certificate = GetCertificate(thumbprint);
if (certificate != null)
{
X509StoreWrapper(StoreName.My, StoreLocation.CurrentUser, (store) =>
X509StoreWrapper(StoreName.My, StoreLocation.CurrentUser, store =>
{
store.Open(OpenFlags.ReadWrite);
store.Remove(certificate);
Expand Down Expand Up @@ -292,7 +286,7 @@ private static bool TryFindCertificatesInStore(string thumbprint,
StoreLocation location, out X509Certificate2Collection certificates)
{
X509Certificate2Collection found = null;
X509StoreWrapper(StoreName.My, location, (store) =>
X509StoreWrapper(StoreName.My, location, store =>
{
store.Open(OpenFlags.ReadOnly);
found = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static List<IAzureSubscription> GetSubscriptions(this IAzureAccount accou

foreach (var subscription in subscriptions)
{
var foundSubscription = profile.Subscriptions.FirstOrDefault((s) => string.Equals(s.Id, subscription, StringComparison.OrdinalIgnoreCase));
var foundSubscription = profile.Subscriptions.FirstOrDefault(s => string.Equals(s.Id, subscription, StringComparison.OrdinalIgnoreCase));
if (foundSubscription != null)
{
subscriptionsList.Add(foundSubscription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class AzureContextExtensions
/// <returns>True if the environment exists in the container, otherwise false</returns>
public static bool HasEnvironment(this IAzureContextContainer container, string name)
{
return container.Environments.Any((e) => string.Equals(e.Name, name, StringComparison.CurrentCultureIgnoreCase));
return container.Environments.Any(e => string.Equals(e.Name, name, StringComparison.CurrentCultureIgnoreCase));
}

/// <summary>
Expand All @@ -38,7 +38,7 @@ public static bool HasEnvironment(this IAzureContextContainer container, string
/// <returns>The environment, or null if no such environment exists in the container</returns>
public static IAzureEnvironment GetEnvironment(this IAzureContextContainer container, string name)
{
return container.Environments.FirstOrDefault((e) => string.Equals(e.Name, name, StringComparison.CurrentCultureIgnoreCase));
return container.Environments.FirstOrDefault(e => string.Equals(e.Name, name, StringComparison.CurrentCultureIgnoreCase));
}

/// <summary>
Expand All @@ -49,7 +49,7 @@ public static IAzureEnvironment GetEnvironment(this IAzureContextContainer conta
/// <returns>True if a subscription with that name exists, false otherwise</returns>
public static bool HasSubscriptionName(this IAzureContextContainer container, string subscriptionName)
{
return container.Subscriptions.Any((s) => string.Equals(s.Name, subscriptionName, StringComparison.CurrentCultureIgnoreCase));
return container.Subscriptions.Any(s => string.Equals(s.Name, subscriptionName, StringComparison.CurrentCultureIgnoreCase));
}

/// <summary>
Expand All @@ -60,7 +60,7 @@ public static bool HasSubscriptionName(this IAzureContextContainer container, st
/// <returns>True if a subscription with that id exists, false otherwise</returns>
public static bool HasSubscriptionId(this IAzureContextContainer container, string id)
{
return container.Subscriptions.Any((s) => string.Equals(s.Id, id, StringComparison.OrdinalIgnoreCase));
return container.Subscriptions.Any(s => string.Equals(s.Id, id, StringComparison.OrdinalIgnoreCase));
}

/// <summary>
Expand All @@ -71,7 +71,7 @@ public static bool HasSubscriptionId(this IAzureContextContainer container, stri
/// <returns>True if a subscription with that id exists, false otherwise</returns>
public static bool HasSubscriptionId(this IAzureContextContainer container, Guid id)
{
return container.Subscriptions.Any((s) => s.GetId() == id);
return container.Subscriptions.Any(s => s.GetId() == id);
}

/// <summary>
Expand All @@ -82,7 +82,7 @@ public static bool HasSubscriptionId(this IAzureContextContainer container, Guid
/// <returns>The subscription with the given name, if it exists, null otherwise</returns>
public static IAzureSubscription GetSubscriptionByName(this IAzureContextContainer container, string subscriptionName)
{
return container.Subscriptions.FirstOrDefault((s) => string.Equals(s.Name, subscriptionName, StringComparison.CurrentCultureIgnoreCase));
return container.Subscriptions.FirstOrDefault(s => string.Equals(s.Name, subscriptionName, StringComparison.CurrentCultureIgnoreCase));
}

/// <summary>
Expand All @@ -93,7 +93,7 @@ public static IAzureSubscription GetSubscriptionByName(this IAzureContextContain
/// <returns>True if a subscription with that id exists, false otherwise</returns>
public static IAzureSubscription GetSubscriptionById(this IAzureContextContainer container, string id)
{
return container.Subscriptions.FirstOrDefault((s) => string.Equals(s.Id, id, StringComparison.OrdinalIgnoreCase));
return container.Subscriptions.FirstOrDefault(s => string.Equals(s.Id, id, StringComparison.OrdinalIgnoreCase));
}

/// <summary>
Expand All @@ -104,7 +104,7 @@ public static IAzureSubscription GetSubscriptionById(this IAzureContextContainer
/// <returns>True if a subscription with that id exists, false otherwise</returns>
public static IAzureSubscription GetSubscriptionById(this IAzureContextContainer container, Guid id)
{
return container.Subscriptions.FirstOrDefault((s) => s.GetId() == id);
return container.Subscriptions.FirstOrDefault(s => s.GetId() == id);
}

/// <summary>
Expand All @@ -115,7 +115,7 @@ public static IAzureSubscription GetSubscriptionById(this IAzureContextContainer
/// <returns>True if the account exists, otherwise false</returns>
public static bool HasAccount(this IAzureContextContainer container, string account)
{
return container.Accounts.Any((a) => string.Equals(a.Id, account, StringComparison.CurrentCultureIgnoreCase));
return container.Accounts.Any(a => string.Equals(a.Id, account, StringComparison.CurrentCultureIgnoreCase));
}

/// <summary>
Expand All @@ -126,7 +126,7 @@ public static bool HasAccount(this IAzureContextContainer container, string acco
/// <returns>The account if it exists, otherwise null</returns>
public static IAzureAccount GetAccount(this IAzureContextContainer container, string account)
{
return container.Accounts.FirstOrDefault((a) => string.Equals(a.Id, account, StringComparison.CurrentCultureIgnoreCase));
return container.Accounts.FirstOrDefault(a => string.Equals(a.Id, account, StringComparison.CurrentCultureIgnoreCase));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ public static bool IsEndpointSetToValue(this IAzureEnvironment environment, stri
if (url != null && environment.IsEndpointSet(endpoint))
{
return environment.GetEndpoint(endpoint)
.Trim(new[] { '/' })
.Equals(url.Trim(new[] { '/' }), StringComparison.InvariantCultureIgnoreCase);
.Trim('/')
.Equals(url.Trim('/'), StringComparison.InvariantCultureIgnoreCase);
}

return false;
Expand Down
Loading