.NET Runtime Error (System.Runtime)

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 5 years and 8 months 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
freeman
Posts: 8
Last visit: Wed Mar 20, 2024 4:09 am

.NET Runtime Error (System.Runtime)

Post by freeman »

Hello,

I found an error related to the EXE creation. If the "Disable Script Block logging while running" option has been activated, a crash may occur when the EXE is executed. But only very few clients were affected.

EventLog Error 1026 - .NET Runtime
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.Runtime.InteropServices.COMException
bei ..(UInt32)
bei ...ctor(.)
bei .+.()
bei System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
bei System.Threading.ThreadHelper.ThreadStart()

Solution
After a long search I found the problem. The following file was broken on the affected clients: C:\Windows\System32\GroupPolicy\Machine\Registry.pol
On these clients also the gpedit.msc could not be opened correctly anymore. After deleting the file, the PowerShell EXE was able to run successfully.

To reproduce the behavior, the Registry.pol can be intentionally destroyed with Notepad (add any text to the file and then save it). After that, there will be an unexpected crash when the EXE is executed.
Unfortunately I can not say how it came to the broken Registry.pol file.

Second Problem
A few months ago I had a similar problem. If the EXE is created with the option "Do not execute unless script block logging is disabled", it can also crash. If the "Script Block Logging" is not deactivated on the system, the message "Script Block Logging not disabled, aborting process" is displayed when the EXE is started. However, on some clients the message was not displayed and an unexpected error occurred during execution. I've found that one of the following folders is missing on the affected clients:
C:\Windows\System32\GroupPolicy\Machine
C:\Windows\System32\GroupPolicy\User

If one of the two folders is missing, the EXE crashes simply without display a warning message. However, the error does not occur when the EXE is started as an administrator. In this case, the missing folders are created automatically. Once the folders are present, the warning message is displayed with a user without admin rights and the EXE doesn't crash.

Because of these two issues, we have already reinstalled Windows because we could not find the error. If you know the behavior, it is not a big deal to fix the problem with the affected clients, but it would be nice if the behavior is fixed.

Thank you.
User avatar
Olga_B
Site Admin
Posts: 196
Last visit: Mon Apr 15, 2024 12:32 pm

Re: .NET Runtime Error (System.Runtime)

Post by Olga_B »

Hello,

Thanks for reporting the issue. We are investigating this and will update you as soon as we have more information.

Could you clarify what is setting in Packager Setting for Output Setting/Alternate Credentials/Run Mode?
User avatar
freeman
Posts: 8
Last visit: Wed Mar 20, 2024 4:09 am

Re: .NET Runtime Error (System.Runtime)

Post by freeman »

I use the following settings in each case.

Output Settings
Manifest Creation: Embed a default manifest
Run Mode: Current user

Execution Restrictions
Do not execute unless Script Block logging is disabled
Disable Script Block logging while running (Requires elevated admin privileges)
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Re: .NET Runtime Error (System.Runtime)

Post by Alexander Riedel »

I’ll see if we can add some additional checks. The folders we can definitely check, just need to see how that interprets as status.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 5 years and 8 months 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.