32 or 64 bit version of product: x64
Operating system: Windows 10.0.17134
32 or 64 bit OS: x64
In my project I'm trying to have the user select one of the sheets of an Excelfile. I'm using EPPlus rather than the COM-object approach for several reasons (version: 18.104.22.168, by using Add-Type -Path 'C:\Temp\EPPlus.22.214.171.124\lib\net40\EPPlus.dll').
But that only works fine in Debug Mode until I assign one of the worksheets to a variable, e.g. with a line of code like this:
Code: Select all
$Sheet = $Package.Workbook.Worksheets['Sheet1']
What happens then, is that all code will be executed normally but only until the point where a breakpoint is set, wherever that might be. And then this error is displayed (which translates to object reference not set to an instance of an object): If I run the project in Debug Mode but without a breakpoint or just run it in normal mode without any debugging, there's no error at all.
Attached Project.ps1 is the project reduced to the minimum but still producing the error.
I hope you can help me with this, as it is kind of cumbersome to change some code, export the whole project to clipboard, paste it into the Powershell ISE, set a breakpoint and try to find what's going wrong and so on. So thanks in advance for any advice and/or help!