Steps to reproduce
Module structure:
PS:81> tree.com F:\tmp\test /F
F:\TMP\TEST
class.psm1
test.psd1
test.psm1
Content of class.psm1
class Foo
{
[string] $Name = "Foo"
}
Content of test.psm1
using module .\class.psm1
class Bar{
[Foo] $foo = [Foo]::new()
[void] Print()
{
Write-Host ($this.foo.Name)
}
}
Content of test.psd1
@{
ModuleVersion = '1.0'
GUID = 'e812e452-6a43-4fe7-9738-375c2fbdd577'
NestedModules = @("class.psm1", "test.psm1")
FunctionsToExport = @()
CmdletsToExport = @()
VariablesToExport = '*'
AliasesToExport = @()
}
Content of run.ps1
using module F:\tmp\test
[Bar]
[Foo]
Run run.ps1
Expected behavior
Both `[Bar]` and `[Foo]` should be resolved.
Actual behavior
PS:90> .\run.ps1
Unable to find type [Foo].
At F:\tmp\test\class.psm1:1 char:1
+ class Foo
+ ~~~~~~~~~
+ CategoryInfo : InvalidOperation: (class Foo
{
...Name = "Foo"
}:TypeDefinitionAst) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
GitCommitId v6.0.0-beta.2-48-g598cebf7b2f0b5bb0b0add97c6393ccfaaa792f5-dirty
OS Microsoft Windows 10.0.15063
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0