[INT] '?'
$ERROR | SELECT -FIRST 1 | % EXCEPTION | % InnerException | % Data | % Item([System.Management.Automation.Interpreter.InterpretedFrameInfo])
MethodName DebugInfo
---------- ---------
<ScriptBlock>
InvalidOperation: Unable to find type [System.Management.Automation.Interpreter.InterpretedFrameInfo]
Name Value
---- -----
PSVersion 7.0.2
PSEdition Core
GitCommitId 7.0.2
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
The value is a non-public type as well, typically that means it's not supported for external use. What are you trying to do with it?
I hoped to get the offending value from there. Obviously, it is not there. But having discoverable but inaccessible things in the public interface is very confusing and unfriendly.
I guess PowerShell has a lot of these things, and it鈥檚 not clear why we need to fix this. For edge cases users can use a reflection.
it鈥檚 not clear why we need to fix this
Because having discoverable but inaccessible things in the public interface is very confusing and unfriendly.
There isn't really any other way to generically add data to any exception efficiently.
That said, I really don't think it's even used anymore. If I had to guess it stopped being used when the System.Linq.Expressions.Expression stopped being able to generate DebugInfo's in the switch to core (at least I'm pretty sure it can't anymore... not 100% on that). Realistically though, it's in such an arcane section of the engine that I wouldn't bet money on it ever being removed. Especially since almost no one really ever looks at the Data property tbh.
There isn't really any other way to generically add data to any exception efficiently.
The problem will go away if you make 'System.Management.Automation.Interpreter.InterpretedFrameInfo' the key.
It's intentionally inaccessible though. The point of using a non-public type as the key is to make it clear it's not supported for external use.
It's intentionally inaccessible though. The point of using a non-public type as the key is to make it clear it's not supported for external use.
And that is exactly why we should not use it as the key. It leaks the private type to the public.
System.Management.Automation.Interpreter is a copy of old .Net code. InterpretedFrameInfo is still present in modern .Net and it is _internal_. We have an issue to move to new .Net Interpreter. So we should keep current code without changes. Any feature requests should be moved to .Net Runtime repository.
We have an issue to move to new .Net Interpreter.
Please show me, I am unable to find it.
@iSazonov Is it possible you're thinking of something else? Edit: They're right, it's a direct copy of Interpreter is PowerShell's instruction runner, it is what is used when a script block does not yet meet the criteria for IL compilation.System.Linq.Expressions.Interpreter.
@iSazonov Is it possible you're thinking of something else?
Interpreteris PowerShell's instruction runner, it is what is used when a script block does not yet meet the criteria for IL compilation.
At least the stack trace is consistent with this hypothesis.
This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.