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

Fixing -Connection on Disconnect-PnPOnline throwing an exception #2093

Merged
merged 6 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Removed

### Fixed
- Fixed issue where passing in `-Connection` to `Disconnect-PnPOnline` would throw an exception [#2093](https://github.com/pnp/powershell/pull/2093)

### Contributors
- Koen Zomers [koenzomers]

## [1.11.0]

Expand Down
5 changes: 5 additions & 0 deletions src/Commands/Base/DisconnectOnline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public class DisconnectOnline : PSCmdlet

protected override void ProcessRecord()
{
// As parameters are passed in by value, there's no use in doing anything with the connection object here, so we'll simply exit.
#pragma warning disable CS0618
if(Connection != null) return;
#pragma warning restore CS6018

if(PnPConnection.Current == null)
{
throw new InvalidOperationException(Properties.Resources.NoConnectionToDisconnect);
Expand Down