Loading of extra types via using is broken

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
ALIENQuake
Posts: 66
Joined: Sun Mar 03, 2013 12:45 pm
Has voted: 1 time

Loading of extra types via using is broken

Post by ALIENQuake »

Hi,
even if I'm adding

Code: Select all

using namespace System.Collections.Generic
the below code:

Code: Select all

using namespace System.Collections.Generic
[List[Object]]$List = Get-ChildItem c:\
throws error:

Code: Select all

ERROR: InvalidOperation: C:\Users\User\Documents\SAPIEN\PowerShell Studio\Projects\List\List.Run.ps1:59
ERROR: Line |
ERROR:   59 |      [List[Object]]$List = Get-ChildItem c:\
ERROR:      |      ~~~~~~~~~~~~~~
ERROR:      | Unable to find type [List].
Product: PowerShell Studio 2020 (64 Bit)
Build: v5.7.181
OS: Windows 10 Enterprise (64 Bit) Polish
Build: v10.0.19041.0
PowerShell version(s): 5.1

Attached the example project (include .run.ps1 files which were generated)
List.zip
(18 KiB) Downloaded 12 times
by brittneyr » Fri Oct 23, 2020 8:23 am
Please try service build 5.7.182.
Go to full post

User avatar
brittneyr
Site Admin
Posts: 613
Joined: Thu Jun 01, 2017 7:20 am
Answers: 6
Been upvoted: 5 times

Re: Loading of extra types via using is broken

Post by brittneyr »

Thank you for reporting this to us.
I think I see the issue. When the 'Run.ps1' script is generated, it is not including the using statement with the script. I will talk to the development team and get back to you.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
brittneyr
Site Admin
Posts: 613
Joined: Thu Jun 01, 2017 7:20 am
Answers: 6
Been upvoted: 5 times

Re: Loading of extra types via using is broken

Post by brittneyr »

A bug report has been filed for the development team. When I have more information, I'll update you.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
brittneyr
Site Admin
Posts: 613
Joined: Thu Jun 01, 2017 7:20 am
Answers: 6
Been upvoted: 5 times

Re: Loading of extra types via using is broken

Post by brittneyr »

Please try service build 5.7.182.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
ALIENQuake
Posts: 66
Joined: Sun Mar 03, 2013 12:45 pm
Has voted: 1 time

Re: Loading of extra types via using is broken

Post by ALIENQuake »

The issue is fixed, thanks.

User avatar
ALIENQuake
Posts: 66
Joined: Sun Mar 03, 2013 12:45 pm
Has voted: 1 time

Re: Loading of extra types via using is broken

Post by ALIENQuake »

Well, now I got

Code: Select all

Exception calling "Invoke" with "0" argument(s): "Type name 'ArrayList' is ambiguous, it could be 'System.Collections.ArrayList' or 'System.Collections.ArrayList'
because both, global.ps1 and MainForm.psf contains

Code: Select all

using namespace System.Collections.Generic
it's not a big deal, just want to report it.

User avatar
brittneyr
Site Admin
Posts: 613
Joined: Thu Jun 01, 2017 7:20 am
Answers: 6
Been upvoted: 5 times

Re: Loading of extra types via using is broken

Post by brittneyr »

I'll make a note to talk to the development team, but this is might be expected behavior. The additional using statement should not be needed in MainForm.psf as the using statement adding in Globabls.ps1 is meant to be shared by all other project files. The Globals.ps1 has its property Shared set to true meaning anything declared (functions, variables, directives, imports, etc) can be used in other project files that have the Build property set to include.

For more information, project file properties' definitions can be found here:
https://info.sapien.com/manuals/powersh ... ties.html
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
ALIENQuake
Posts: 66
Joined: Sun Mar 03, 2013 12:45 pm
Has voted: 1 time

Re: Loading of extra types via using is broken

Post by ALIENQuake »

But if I remove all 'using namespace ...' from all files instead of the ones which are 'shared', I'm losing IntelliSense of the types:
lTlSXgw[1].png
lTlSXgw[1].png (2.17 KiB) Viewed 238 times
Can this be somehow handled?

User avatar
brittneyr
Site Admin
Posts: 613
Joined: Thu Jun 01, 2017 7:20 am
Answers: 6
Been upvoted: 5 times

Re: Loading of extra types via using is broken

Post by brittneyr »

We will see what we can do.
Brittney Ryn
SAPIEN Technologies, Inc.