Skip to content

Conversation

@gautamdsheth
Copy link
Collaborator

Before creating a pull request, make sure that you have read the contribution file located at

https://github.com/pnp/powerShell/blob/dev/CONTRIBUTING.md

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #X, partially fixes #Y, mentioned in #Z, etc.

What is in this Pull Request ?

Please describe the changes in the PR.

Guidance

  • You can delete this section when you are submitting the pull request.*
  • Please update this PR information accordingly. We use this as part of our release notes in monthly communications.
  • Please target your PR to Dev branch. If you do not target the Dev branch we will not accept this PR.

Copilot AI review requested due to automatic review settings September 26, 2025 18:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors error handling and improves exception messages across multiple admin commands by modernizing null checks, updating exception types for better semantic accuracy, replacing string formatting with string interpolation, and applying C# collection expression syntax where appropriate.

  • Modernizes null validation using ArgumentNullException.ThrowIfNull() instead of traditional if-null-throw patterns
  • Updates exception types to be more semantically appropriate (e.g., InvalidOperationException instead of ArgumentNullException for operational failures)
  • Replaces string formatting with string interpolation for cleaner, more readable code

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Tests/PnP.PowerShell.Tests.csproj Updates target framework from .NET 6.0 to .NET 8.0
src/Commands/Utilities/REST/RestHelper.cs Modernizes string formatting using string interpolation
src/Commands/Utilities/DynamicLinq.cs Replaces manual null checks with ArgumentNullException.ThrowIfNull()
src/Commands/SiteDesigns/SetBuiltInSiteTemplateSettings.cs Refactors null check and adds required System import
src/Commands/SiteDesigns/GetBuiltInSiteTemplateSettings.cs Refactors null check and adds required System import
src/Commands/AzureAD/RegisterAzureADApp.cs Replaces resource strings with inline error messages
src/Commands/AzureAD/NewAzureADGroup.cs Updates confirmation message to use string interpolation
src/Commands/Apps/GetAzureADAppSitePermission.cs Optimizes list initialization with capacity
src/Commands/Apps/GetApplicationCustomizer.cs Modernizes list initialization with collection expression
src/Commands/Admin/SetTenantSyncClientRestriction.cs Improves error message with inline string interpolation
src/Commands/Admin/SetTenant.cs Optimizes list initialization with capacity
src/Commands/Admin/RemoveTenantSyncClientRestriction.cs Modernizes list initialization with collection expression
src/Commands/Admin/RemoveTenantSite.cs Updates confirmation message using string interpolation
src/Commands/Admin/GetTenantDeletedSite.cs Modernizes list initialization and improves exception types
src/Commands/Admin/GetStorageEntity.cs Optimizes list initialization with capacity
src/Commands/Admin/GetContainerTypeConfiguration.cs Improves exception type and error message
src/Commands/Admin/AddTenantRestrictedSearchAllowedList.cs Updates exception type for better semantic accuracy

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <[email protected]>
@gautamdsheth gautamdsheth merged commit 41d2fcd into dev Sep 26, 2025
3 checks passed
@gautamdsheth gautamdsheth deleted the feat/imp-code branch October 3, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants