question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Get-PartnerInvoiceStatement - Cannot access a closed Stream

See original GitHub issue

This used to work last month but no longer does.

I tested with old modules, new modules, and on three different computers. All return the same error for all invoices. So the command is basically broken at this point.

Steps to reproduce

$InvoiceId = Get-PartnerInvoice | Select-Object -Property InvoiceId -First 1
Get-PartnerInvoiceStatement -InvoiceId $InvoiceId.InvoiceId -OutputPath $Destination -Overwrite

Expected behavior

Download of PDF

Actual behavior

$InvoiceId = Get-PartnerInvoice | Select-Object -Property InvoiceId -First 1
Get-PartnerInvoiceStatement -InvoiceId $InvoiceId.InvoiceId -OutputPath $Destination -Overwrite
Get-PartnerInvoiceStatement : Cannot access a closed Stream.
At line:1 char:1
+ Get-PartnerInvoiceStatement -InvoiceId $InvoiceId.InvoiceId -OutputPa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-PartnerInvoiceStatement], ObjectDisposedException
    + FullyQualifiedErrorId : System.ObjectDisposedException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerInvoiceStatement

Then it produces an empty pdf file with the name of the invoice…

Module

Get-Module -Name PartnerCenter

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.5.1904.2 PartnerCenter                       {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserRoleMember, Connect-PartnerCenter, Disconnect-PartnerCenter...}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Apr 10, 2019

Hi @cblackuk,

The required code changes have been merged, and this issue will be addressed in the next release. Right now I do not know the exact date when this release will be available through the PowerShell gallery. My hope is have it available before the end of the month.

0reactions
cblackukcommented, May 1, 2019

It works now! Thanks @isaiahwilliams!

Read more comments on GitHub >

github_iconTop Results From Across the Web

MemoryStream - Cannot access a closed Stream
Hi why using (var sw = new StreamWriter(ms)) returns Cannot access a closed Stream exception . Memory Stream is on top of this...
Read more >
Cannot access a closed Stream when running this ...
System.ObjectDisposedException: Cannot access a closed Stream when running this statement MemoryStream stream = (MemoryStream)data.GetData( ...
Read more >
Cannot access a closed Stream
Then I Want Make a XmlDocument Using MemoryStream. But I Have Following a Error Message: "Cannot access a closed Stream".
Read more >
System.ObjectDisposedException: Cannot access a closed ...
Following our migration to cosmos SDK v3 and usage of feed range API, we started to see this exception occasionally in our traces:....
Read more >
C# – getting “Cannot access a closed Stream” here
The problem is that the stream is closed (via Dispose() ) at the end of the using block. You retain a reference to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found