TypeNotFound when referencved in module file
Posted: Sun Jan 22, 2023 2:54 am
To help you better we need some information from you.
*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build: 5.8.215
Operating system: Windows 10
PowerShell version(s): 5
32-bit version of software? 64
Hello. I have a PS1 file which references a PSM1 via using module as below:
Inside this PSM1 is a line to throw an exception if a file is not found (System.IO.FileFormatException). However Powershell Studio seems to think that type cannot be found. Full message below.
All help appreciated!
Bill
>> Debugging (ClaimsPipeline.ps1) Script...
>> Platform: V5 64Bit (STA)
ERROR: . : At C:\Scripts\SqlQuery.psm1:52 char:20
ERROR: + throw [System.IO.FileFormatException] "'$Path' does not h ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: Unable to find type [System.IO.FileFormatException].
line (1, 2): ERROR: At Line: 1 char: 2
ERROR: + ."C:\Scripts\ClaimsPipeline.ps1"
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidOperation: (C:\Scripts\SqlQuery.psm1:String) [], RuntimeException
ERROR: + FullyQualifiedErrorId : TypeNotFound
ERROR:
*** Debug Session ended. ***
>> Script Ended
*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build: 5.8.215
Operating system: Windows 10
PowerShell version(s): 5
32-bit version of software? 64
Hello. I have a PS1 file which references a PSM1 via using module as below:
- using namespace System.IO
- using module .\SqlQuery.psm1
All help appreciated!
Bill
>> Debugging (ClaimsPipeline.ps1) Script...
>> Platform: V5 64Bit (STA)
ERROR: . : At C:\Scripts\SqlQuery.psm1:52 char:20
ERROR: + throw [System.IO.FileFormatException] "'$Path' does not h ...
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: Unable to find type [System.IO.FileFormatException].
line (1, 2): ERROR: At Line: 1 char: 2
ERROR: + ."C:\Scripts\ClaimsPipeline.ps1"
ERROR: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidOperation: (C:\Scripts\SqlQuery.psm1:String) [], RuntimeException
ERROR: + FullyQualifiedErrorId : TypeNotFound
ERROR:
*** Debug Session ended. ***
>> Script Ended