TypeNotFound when referencved in module file

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
billmacuk
Posts: 1
Last visit: Sun Jan 22, 2023 2:54 am

TypeNotFound when referencved in module file

Post 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
User avatar
brittneyr
Site Admin
Posts: 1331
Last visit: Fri Jan 27, 2023 12:57 pm
Answers: 27
Been upvoted: 22 times

Re: TypeNotFound when referencved in module file

Post by brittneyr »

Can you please run your script in the console (Ctrl + F8) then copy and paste the error output here?
Brittney
SAPIEN Technologies, Inc.