-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Open
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Languageparser, language semanticsparser, language semantics
Description
Strange behavior with "using module"
Steps to reproduce
-
Install-Module psquickgraph -Scope CurrentUser
-
save the following script to c:\temp\processgraph.ps1
using module PSQuickGraph
class MyProcess : PSGraph.PSGraphVertex {
[string]$ProcessName
[int]$ProcessID
[int]$ParentProcessId
[string]get_UniqueKey() { return $this.ProcessID }
}
$ps = gwmi win32_process
$g = New-Graph -Type AdjacencyGraph
$ps | % {
$p = [MyProcess]@{
ProcessName = $_.ProcessName
ProcessID = $_.ProcessID
ParentProcessId = $_.ParentProcessId
Label = $_.ProcessName
}
Add-Vertex -Vertex $p -Graph $g
}
$g.Vertices | % {
$v1 = $_
$v1.processname
$v1.ProcessId
$g.Vertices | % {
$v2 = $_
if ($v1.ProcessId -eq $v2.ParentProcessId){
Add-Edge -From $v2 -To $v1 -Graph $g
}
}
}
$graphFile = "c:\temp\testGraph.gv"
$svgOutFile = "c:\temp\testGraph.svg"
$pngOutFile = "c:\temp\testGraph.png"
Export-Graph -Graph $g -Format Graphviz -Path $graphFile -Verbose
$tempFile = Get-Content $graphFile
$tempFile[0] += "`r`n" + "rankdir = LR"
$tempFile | Out-File $graphFile -Encoding ascii- invoke the script by using c:\temp\processgraph.ps1
Expected behavior
a file c:\temp\testGraph.gv should be generated.
Actual behavior
script fails with the following message
At C:\temp\processGraph.ps1:3 char:19
+ class MyProcess : PSGraph.PSGraphVertex {
+ ~~~~~~~~~~~~~~~~~~~~~
Unable to find type [PSGraph.PSGraphVertex].
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : TypeNotFound
Environment data
Name Value
PSVersion 5.1.14393.953
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.953
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
> $PSVersionTable
Source code for PSQuickGraph is here
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Languageparser, language semanticsparser, language semantics