-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
…BLE BREAKING CHANGE FOR DATA ANALYTICS! There is 1 cmdlet that outputs multiple types, but boxed as a base type. I've updated the calls to the management SDK as to no longer use obsolete calls. However, the type from those calls is slightly changed to removed a few properties. But, that type isn't DIRECTLY returned. Again, boxed as the same base type that was returned prior. Made PowerBI dependent on Management.PowerBI as to remove an output conflict warning.
…d out file. Removed excess dependencies from netcore projects that were manually converted.
# Conflicts: # src/ResourceManager/DeviceProvisioningServices/Commands.DeviceProvisioningServices.Test/IotDpsController.cs
# Conflicts: # src/ResourceManager/AnalysisServices/Commands.AnalysisServices/Models/AzureAnalysisServicesServer.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/ApiManagementClient.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/ExportAzureApiManagementApi.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/GetAzureApiManagementPolicy.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/NewAzureApiManagementBackendCredential.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/NewAzureApiManagementBackendProxy.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/NewAzureApiManagementLogger.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/RemoveAzureApiManagementOperation.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SetAzureApiManagementLogger.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Commands/SetAzureApiManagementPolicy.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/UnitTests/PsApiManagementTests.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands/AzureApiManagementCmdletBase.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement/Commands/BackupAzureApiManagement.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement/Models/ApiManagementLongRunningOperation.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement/Models/PsApiManagement.cs # src/ResourceManager/ApiManagement/Commands.ApiManagement/Models/PsApiManagementRegion.cs # src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs # src/ResourceManager/LocationBasedServices/Commands.LocationBasedServices/Models/PSLocationBasedServicesAccountKeys.cs # src/ResourceManager/LogicApp/Commands.LogicApp/Utilities/WebsitesClient.cs # src/ResourceManager/Maps/Commands.Maps/MapsAccount/GetAzureMapsAccount.cs # src/ResourceManager/Maps/Commands.Maps/MapsAccount/GetAzureMapsAccountKey.cs # src/ResourceManager/Maps/Commands.Maps/MapsAccount/NewAzureMapsAccount.cs # src/ResourceManager/Maps/Commands.Maps/MapsAccount/NewAzureMapsAccountKey.cs # src/ResourceManager/Maps/Commands.Maps/MapsAccount/RemoveAzureMapsAccount.cs # src/ResourceManager/Maps/Commands.Maps/Models/PSMapsAccount.cs # src/ResourceManager/Maps/Commands.Maps/Models/PSMapsAccountSku.cs # src/ResourceManager/Media/Media.sln # src/ResourceManager/Network/Commands.Network/Models/PSPeering.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorCommand.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/ConnectionMonitor/SetAzureNetworkWatcherConnectionMonitorCommand.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/GetAzureNetworkWatcherCommand.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/GetAzureNetworkWatcherReachabilityProvidersListCommand.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/GetAzureRMNetworkWatcherReachabilityReportCommand.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/NetworkWatcherBaseCmdlet.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/PacketCapture/NewAzureNetworkWatcherPacketCaptureCommand.cs # src/ResourceManager/Network/Commands.Network/NetworkWatcher/RemoveAzureNetworkWatcherCommand.cs # src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/NewAzureVirtualNetworkGatewayCommand.cs # src/ResourceManager/Network/Commands.Network/VirtualNetworkGateway/UpdateAzureVirtualNetworkGatewayCommand.cs # src/ResourceManager/Profile/AzureRM.Profile.Netcore.psd1 # src/ResourceManager/Profile/Commands.Profile.Test/LongRunningCmdletTests.cs # src/ResourceManager/RecoveryServices/RecoveryServices.Backup.sln # src/ResourceManager/RecoveryServices/RecoveryServices.sln # src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/SdkModels/Resources/PSResource.cs # src/ResourceManager/Scheduler/Commands.Scheduler/Cmdlets/UpdateAzureSchedulerServiceBusQueueJobCommand.cs # src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/AddAzureRmServiceFabricNodeType.cs # src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/RemoveAzureRmServiceFabricNodeType.cs # src/ResourceManager/ServiceFabric/Commands.ServiceFabric/Commands/ServiceFabricClusterCertificateCmdlet.cs # src/ResourceManager/Sql/Commands.Sql.Test/UnitTests/AzureSqlDatabaseAttributeTests.cs # src/ResourceManager/Sql/Commands.Sql/Database Backup/Cmdlet/RestoreAzureRMSqlDatabase.cs # src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupAdapter.cs # src/ResourceManager/Sql/Commands.Sql/Database Backup/Services/AzureSqlDatabaseBackupCommunicator.cs # src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/NewAzureSqlDatabase.cs # src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/SetAzureSqlDatabase.cs # src/ResourceManager/Sql/Commands.Sql/Database/Services/AzureSqlDatabaseAdapter.cs # src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/NewAzureSqlElasticPool.cs # src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/SetAzureSqlElasticPool.cs # src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/NewAzureSqlDatabaseCopy.cs # src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/NewAzureSqlDatabaseSecondary.cs # src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebApps/NewAzureWebApp.cs # src/ResourceManager/Websites/Commands.Websites/Strategies/PSCmdletAdapter.cs # tools/AzureRM/AzureRM.psm1
# Conflicts: # src/ResourceManager/Insights/Commands.Insights.Test/CustomPrinterTests.cs # src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/GalleryTemplatesClientTests.cs # src/ResourceManager/Resources/Commands.Resources/ActiveDirectory/NewAzureADServicePrincipalCommand.cs # src/ResourceManager/Resources/Commands.Resources/ActiveDirectory/UpdateAzureADServicePrincipalCommand.cs
@@ -138,21 +138,6 @@ public NetworkClient() | |||
} | |||
} | |||
|
|||
namespace Microsoft.Azure.Management.Internal.Network.Common | |||
{ | |||
public interface IResourceReference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I would think this would be used throughout their client models, as it should be used in any reference to another network resource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file itself is NetCore specific. And, nothing was using that interface in the NetCore module code... So, I don't know.
UnitTestHelper.CheckCmdletParameterAttributes(type, "SqlAdministratorCredentials", isMandatory: true, valueFromPipelineByName: false); | ||
UnitTestHelper.CheckCmdletParameterAttributes(type, "Tags", isMandatory: false, valueFromPipelineByName: false); | ||
UnitTestHelper.CheckCmdletParameterAttributes(type, "ServerVersion", isMandatory: false, valueFromPipelineByName: false); | ||
UnitTestHelper.CheckCmdletParameterAttributes(type, "ServerName", true, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These calls are really a lot less descriptive now, and this test is more difficult to maintain. We should revert changes related to the application of this rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment below.
} | ||
|
||
[Fact] | ||
[Trait(Category.AcceptanceType, Category.CheckIn)] | ||
public void SetAzureSqlServerAttributes() | ||
{ | ||
Type type = typeof(SetAzureSqlServer); | ||
UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: true); | ||
UnitTestHelper.CheckCmdletModifiesData(type, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same. I've seen this applied innocuously in a few places, but generally, this seems like a bad rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is exposing a code smell. If you want patterns like this, it is better to make a POCO type that just has these things as properties. Then, make that type the parameter to the method. For CheckCmdletParameterAttributes
, you could do this:
public CmdletParameterAttributes
{
public Type CmdletType {get; set;}
public string ParameterName {get; set;}
public bool IsMandatory {get; set;}
public bool ValueFromPipelineByName {get; set;}
}
// In the caller:
var cmdletParameterAttributes = new CmdletParameterAttributes
{
CmdletType = type,
ParameterName = "ServerName",
IsMandatory = true,
ValueFromPipelineByName = false
};
UnitTestHelper.CheckCmdletParameterAttributes(cmdletParameterAttributes);
This is the general C# style for handling a bunch of parameters for methods. Then, you always have to be explicit when initializing their value.
As seen here, a [Flags] enum is also a good option.
https://softwareengineering.stackexchange.com/questions/307773/specify-optional-parameter-names-even-though-not-required
Again, I'm not trying to redesign all our code. I'm just stating why this suggestion is generally not a bad one. I can, however, enable it to use named arguments for literal values, which seems to be the style that they are following here.
@@ -33,7 +33,7 @@ public TypeConversionTests(ITestOutputHelper output) | |||
[Trait(Category.AcceptanceType, Category.CheckIn)] | |||
public void CanConvertNullEnvironments() | |||
{ | |||
Assert.Null((PSAzureEnvironment)null); | |||
Assert.Null(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, so the point here was to test application of the explicit type converter for these types. It's possible the compiler might optimize these out, but likely only when the explicit conversion is doing what it is supposed to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would apply to the other applications of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boxing here would make no difference if you are doing (Thing)null == null
which is essentially what this is doing, right? You can't actually cast null
. It just gets boxed.
https://dotnetliberty.com/index.php/2015/10/11/cast-to-object-before-comparing-to-null/
AFAIK, null
is of type Object. Every reference type derives of Object. So, even though you are casting to some reference type, it'll get compared as boxed Object when doing the null check. I could be wrong on that, though.
As an aside, obviously Assert.Null(null)
will always be true, so optimizing this just looks goofy.
@@ -64,16 +64,14 @@ RequiredAssemblies = '.\Microsoft.Azure.Commands.Common.Authentication.Abstracti | |||
'.\Microsoft.Azure.Commands.ResourceManager.Common.dll', | |||
'.\Microsoft.WindowsAzure.Commands.Common.dll', | |||
'.\Microsoft.WindowsAzure.Commands.Common.Storage.dll', | |||
'.\Hyak.Common.dll', '.\Microsoft.ApplicationInsights.dll', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like these are still needed
@@ -1,104 +0,0 @@ | |||
// ---------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, this should be used in resource template deployment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't comment this out. I just deleted it since the entire file was commented out.
@@ -29,10 +29,6 @@ | |||
<WarningsAsErrors /> | |||
</PropertyGroup> | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="7.1.0-preview" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<ProjectReference Include="..\..\..\Common\Commands.Common.Storage\Common.Storage.Netcore.csproj" />
That project holds the common reference to Storage at the moment. It was a later goal to remove that reliance, but for now, it makes sure that anything using it uses the same version of the management library.
See my email, I think we need to restructure this and exclude generated code before we can merge. |
* update OutputType in cmdlet * add examples for add and remove cmds * fix change log for circuit connection commands * ValidateRange should specify max as 10 * add New-AzureRMNetworkWatcherProtocolConfiguration * start adding test for circuit connection * fix idictionary issue for header * Fix Get-AzureRmTrafficManagerProfile Parameters Calling Get-AzureRmTrafficManagerProfile with the -Name parameter will return nothing because the cmdlet requires the -ResourceGroupName parameter when using -Name. I've updated the cmdlet parameters to use ParameterSets, which is similar to how other cmdlets handle this situation. The user can either call the cmdlet without any parameters, or with the -ResourceGroupName parameter, or if calling using the -Name parameter, they will now be prompted to enter in a value for the -ResourceGroupName parameter. * Update Set-AzureRmVMDiskEncryptionExtension.md I happened to be testing a similar script and think I ran across a few small issues with the examples. 1. $KEKName not set in examples 3&4 2. New-AzureRmADApplication seems to use -CertValue rather than -KeyValue and -KeyType https://docs.microsoft.com/en-us/powershell/module/azurerm.resources/new-azurermadapplication?view=azurermps-5.7.0 3. Looks like the KEK bit is missing from Set-AzureRmVMDiskEncryptionExtension in Example 4 for cert + KEK. * Update Set-AzureRmVMDiskEncryptionExtension.md * Add migration guide for Azure PowerShell 6.0.0 release * record network watcher test * update session record for circuit connection * Update Change Log * Update Markdown Help File * Suppress false-positive breaking change exception for TrafficManager * Support to set based branch for git clone content repo * Update New-AzureStorageAccountSASToken.md There was an blank missing. The link for more details on "Constructing an Account" was not clickable. * Update ChangeLog.md * add circuit connection crud json file to session records * verify playback mode * Add usage detail markdown file * Update paramter sets for gateway operations and help doc * Fix md by removing trailing yaml * Addressed comments on Tag, csproj files, depreciated InvoiceName, missing parameters in PSUsage model * Update ChangeLog Update ChangeLog * [Maps] Rename folders and files from LocationBasedServices * [Maps] Rename help file names * [Maps] Renaming variables, strings, descriptions, etc. * Bumped Network SDK version to 19.0.0-preview * Re-recorded test for VPN Gateway * Remove dll-help.psd1 and .pshproj files * Remove spaces from DeviceProvisioningServices tags field * update help docs for New-AzureRmNetworkWatcherProtocolConfiguration * Re-serialize module metadata and empty BreakingChangeIssues.csv * Fix issue Azure#5998 - certificates created without server authentication usage * Remove missed dll-Help.psd1 reference * Fix issue where default environments weren't being retrieved without a default context set * Recommitting to a new branch to untangle pulls * remove support for set and new commands for circuit connection * Add -ExtendedProperty parameter to New-AzureService and Set-AzureService cmdlets * Fix bug in appveyor.yml * Bumped Network's version in other packages * Updated DNS zone recordings * Suppress credentials in VPN Gateway test * fixed type on example #3 * Fixed incorrect credential suppression * Updated ChangeLog.md * Support piping on all circuit connection commands * Modify Commands.Sql.csproj and Commands.Sql.Test.csproj to use local update Management.Sql.dll binary for now * adding new parameters for create/update elastic pool and database cmdlets. update related db/elastic pool create/update tests * Fix issue in composing PUT request body for database and pool -- Sku object null scenario * Update elasticPool adaptor and communicator to using new sdk when trying to get databases inside a pool (Get-AzureRmSqlElasticPoolDatabase) * Update database replication related models and services to use new autorest sdk (instead of Legacy sdk) to do database copy/secondary, etc. Rerecord all replication related tests * address comments on database/elastic pool cmdlets-- null check, remove commentout codes, etc * address comments. Used -Edition -RequestedServiceObjectiveName for vcore database/pool. Only add new parameter -Vcore to specify vcore number. Modify the database replications, database restore related communicator to use new database webapi * used the published SDK 1.14.0-preview. Update LocationCapabilities model to use new API version (2017 version). Re-record LocationCapability tests * Update all db creation related cmdlets to support vcore database * Update db/elasticpool creation/update tests * Add functions to get skuname when given tier for database and pool, to avoid duplicate codes in cmdlets * use dictionary to mapping tier to skuname * re-record tests and update help file * Update restore cmdlet. Re-recording LTR restore test. Update changeLog. * address comments. and revert all changes related with 'replication links' * using published sdk 1.15.0-preview for the build issue. * Update cmds for creating/updating elasticpool. Use Patch way to do pool update inorder to support correct behaviors for updating pool * fix the yaml trailing issue in help files * Add the removed properties back in DatabaseModel and ElasticPoolModel to avoid breaking changes. And add Edition to BreakingChangeIssue exception * Update BreakingChangeIssues.csv * Address comments. Re-recording part of the failed tests in CI build * re-recording part of the failed tests in CI build. * add new tests records to output dic * Addressed comments on parameter type and typo, and regenerated test sessions * revert changes to common.ps1 * link website for New-AzureRmNetworkWatcherProtocolConfiguration.md * Address PR comments * re-record backup LTR v2 tests, AuditingClassicStorageTests, ThreatDetectionclassicStorageTests * address comments * re-record tests related with ClassicStorage * Fix changelog and minor changes for comments * Fix test TestExportDatabase and re-record it. * Update Remove-AzureRmVirtualNetworkGatewayDefaultSite.md Fixed a typo * Update azure-powershell-design-guidelines.md * Fix null parameter for recurse i setaclentry * fix issue with network watcher md files * Regenerate help files * Update Set-AzureRmVirtualNetwork.md * address vladimir comments * add support to set command to allow piping * removing writing to peer to fix return type * Add StaticAnalysis checks for - No output type - Optional positional parameters - Parameter set names containing a space - Cmdlets with no default parameter set name and multiple sets * Update BreakingChangeIssues.csv * Record auditing & threat detection tests * Update LICENSE.txt updating to recent EULA and 3rd party * Update License.rtf updating eula and 3rd party * revert change to set circuit command * remove value from pipeline by property name from all circuit conneciton commands * Update License.rtf RIpped out unnecessary formatting added by word that caused a view issue inside the msi * Skip severel tests that can only run in live mode (talked with test owner). * Add tests for new static analysis checks * [Maps] Use Maps SDK over LocationBasedServices SDK * fix test * fix test * move from on demand to regular build * Update AzureRM.Network.psd1 * fix based on comments * Update New-AzureRmNetworkWatcherProtocolConfiguration.md * make protocol required * fix test * move from on demand to regular build * Add unittests for new apis * address comments. Remove Sku and PerDatabaseSettings from DatabaseModel and ElasticPoolModel.Modify the database and elastic pool response for powershell. * Update the elastic pool tests. fix bug. * Save export file to adl * Address comments. ReplicationLinkModel, DatabaseCopyModel, remove duplication null check and incorrect help message. * Add dependence in the ServiceManagement sln to fix the sign job * Update SignatureIssues.csv * Add default parameter set for two cmdlets. Update ChangeLog.md and remove unnecessary package files * small type fix * Example fixes for `New-AzureRmStorageAccount`. * Updating examples for BGP service communities.. * Update Get-AzureRmBgpServiceCommunity.md * Update Get-AzureRmBgpServiceCommunity.md * Fix the example for Export-AzureRmDataLakeStoreChildItemProperties * Update Test-AzureRmDnsAvailability Help File Fixed header, added description, added example. * Update changelog file * Fixed header in Get-AzureRmVirtualNetworkPeering * Update Remove-AzureRmVirtualNetworkPeering.md Fixed the header in the file, Added a description and Synopsis * Update AzureRM.Network.md Added descriptions to multiple cmdlets here. * fix breaking change issue and signature issue * Small fix. Use SkuName in the pool model to keep alignment with other models. Rerecord related pool tests * Updating Networking tests with owner attributes * Update ChangeLog.md * Update NewAzureNetworkWatcherProtocolConfiguration.cs * Fix to `New-AzureRmAks` help text. * Fix issue with Clear-AzureRmContext where old default context name was being used for empty context * Strategies library: Version 4, new WriteWarning method. * Websites.Strategies are replaced by Common.Strategies library. * Added comments with full team names * update cmdlets based on autorest .net client 2018-01-01 * Refactor InputObject variables and other review comments * get identity properties from InputObject and allow override by parameters * Skip failing Batch tests in on-demand build (see issue Azure#5006) * Update SignatureIssues.csv * Cleanup dependencies and assembly references * remove one more reference * Update modules for 6.1.0 release * Fix error in paths for Profile RequiredAssemblies * Fix for empty examples. * [Maps] Add legacy ResourceManager & update test recordings * [Maps] Add legacy ResourceManager & update test recordings * Add example to Stop-AzureRmResourceGroupDeployment.md * [Maps] Resolving merge revision requests * [Maps] Resolving merge revision requests (2) * Remove spaces in location before comparision * Update Stack.sln * [Maps] Add PassThru to Remove method, resolve build failure * [Maps] Update help files to reflect -PassThru param addition * [Maps] Fix trailing yaml string for PassThru * Release new KeyVault preview module * address comments * Update KeyVault.sln * fix test
Update Get-AzSqlDatabaseSensitivityClassification.md
Example #3 heading was listed twice
Description
Fix for: Azure#5565
Checklist
CONTRIBUTING.md
platyPS
module