-
Notifications
You must be signed in to change notification settings - Fork 380
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
Object reference not set to an instance of an object. #1867
Comments
Hi @DomBros can you clarify a bit more about the steps to reproduce, did you put the functions in the variable you are piping to |
Hi @DomBros - could you also run |
I'm sorry for giving so little information but I didn't even know where to start
but now i have:
and now i am trying to catch the error |
OK, so the error looks like this: and these 4 of my functions appear: |
i'm trying to get the error back because it doesn't happen every time and when it does it occurs at different times |
next few runs of Invoke-ScriptAnalyzer were OK |
what I wanted to emphasize is that |
Thanks for supplying that info, which helped. |
Did you noticed that my errors are always connected with |
so as work-a-round i did something like this:
|
Yes, I was going to ask a) how your settings file looks like and b) why you run |
maybe I'm over-engineering :) or I don't understand something, but I use all your rules |
It's kind of hard to comment on this in a way that is helpful. There are ways to make the state management more consistent but they aren't easy to add to the existing architecture. I think at some point the three of us should get together and discuss a v2. I know Rob started talking about that a while back but it'd be great to revisit. |
@bergmeister @SeeminglyScience |
The main issue is the state is assumed to only be used from one runspace at a time. I think if anything the exception helps us escape the corrupted state faster, and trying to silence it may end up giving us more issues that it solves |
I'd instead propose to have a retry (up to 3x). If we add a lock, the impact on speed for the average user would be dramatic (multiple factors) |
I'm definitely not suggesting a lock, but retry is not likely to be a silver bullet there. So Ideally, PSSA would do one of these:
Another issue we get reports of is from folks using |
Good morning,
I have a PowerShell module at work with almost 400 functions. Recently I switched from PSScriptAnalyzer version 1.13.0 to version 1.21.0, fixed a lot of problems, but I have one left. On random functions I get the error:
Exception: Object reference not set to an instance of an object.
If I use the Invoke-ScriptAnalyzer function with the -Verbose switch, the error does not occur. I discovered this by accident while looking for which function is causing the error.
Please advise how to trace the cause.
Somewhere I found information that this can be caused by the Export-ModuleMember function, but I don't want to get rid of it because I would have to fiddle with building the manifest file and that's how Psake does it for me.
For building and checking a powershell module I use
TeamCity and
Psake = '4.9.0'
Pester = '5.3.3'
BuildHelpers = '2.0.16'
PSScriptAnalyzer = '1.21.0'
PSDepend = '0.3.8'
The text was updated successfully, but these errors were encountered: