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.
This topic is 3 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
ALIENQuake
Posts: 112
Last visit: Mon Jan 29, 2024 7:35 am
Has voted: 4 times

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 321 times
by brittneyr » Wed Jan 13, 2021 9:15 am
This issue of duplicate using statements across project files set as content has been resolved. This fix will be released following the next service build release.
Go to full post
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 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
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 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
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Loading of extra types via using is broken

Post by brittneyr »

Please try service build 5.7.182.
Brittney
SAPIEN Technologies, Inc.
User avatar
ALIENQuake
Posts: 112
Last visit: Mon Jan 29, 2024 7:35 am
Has voted: 4 times

Re: Loading of extra types via using is broken

Post by ALIENQuake »

The issue is fixed, thanks.
User avatar
ALIENQuake
Posts: 112
Last visit: Mon Jan 29, 2024 7:35 am
Has voted: 4 times

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: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 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
SAPIEN Technologies, Inc.
User avatar
ALIENQuake
Posts: 112
Last visit: Mon Jan 29, 2024 7:35 am
Has voted: 4 times

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 14421 times
Can this be somehow handled?
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Loading of extra types via using is broken

Post by brittneyr »

We will see what we can do.
Brittney
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Loading of extra types via using is broken

Post by brittneyr »

This issue of duplicate using statements across project files set as content has been resolved. This fix will be released following the next service build release.
Brittney
SAPIEN Technologies, Inc.
This topic is 3 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.