Page 1 of 1

TypeNotFound when referencved in module file

Posted: Sun Jan 22, 2023 2:54 am
by billmacuk
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:
  1. using namespace System.IO
  2. using module .\SqlQuery.psm1
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

Re: TypeNotFound when referencved in module file

Posted: Mon Jan 23, 2023 8:10 am
by brittneyr
Can you please run your script in the console (Ctrl + F8) then copy and paste the error output here?