So, a very strange problem.
Using VS2015 and .net 4.52
I developed this PowerShell C # code, it runs a script and catches the output. eg:
using (PowerShell powerShellInstance = PowerShell.Create()) { powerShellInstance.AddScript(scriptContents); Collection<PSObject> PSOutput = powerShellInstance.Invoke(); if (powerShellInstance.Streams.Information.Count > 0) { foreach (var item in powerShellInstance.Streams.Information) {
Compiles and runs (on a computer with Windows 10 pro), no problem.
Until I received a new machine (surface pro 4, as well as windows 10 pro) and tried to compile the code, I get this error:
"PSDataStreams" does not contain a definition for "Information", and no extension method "Information" that accepts the first argument of type "PSDataStreams" can be found (do you miss the use directive or assembly reference?)
It is all based on TFS, so I'm sure this is the same code.
If I define the definition on two machines, the problem becomes obvious:

So, I commented on the non-compiled code and ran it to see what happens at runtime:

So, the property is. Has anyone got a good explanation for this?
BTW: msdn documentation does not mention information property.
source share