Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules Do not post any licensing information in this forum.
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 6 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.
I have made a GUI that lets users login with sql creds. It has 2 textboxes for email and pw and uses Connect-DbaInstance from dbatools.io to test connection.
I have gone through each step on making my GUI... adding logic... building an EXE... and this is the only part where it keeps the EXE alive after closing it.
the Connect-DbaInstance cmdlet can be found on the dbatools.io website but I cannot share external links on this post since I need a minimum of 5 posts.
You have some piece of code that keeps it alive. WIth the provided information there is no way to determine why this is happening.
You cannot hide a form that is a dialog. Making a dialog not visible will close the dialog. Once all dialogs are closed then any code running outside of the dialogs will control what happens.
castillocaleb wrote: ↑Fri Oct 16, 2020 1:54 pm
I think it's keep the SMO SQL connection object is staying even though I am closing the connection using
ConnectionContext.SqlConnectionObject.Close()
A SQL connection cannot block a process exit. Connections are globally cached to the process and get called to close and destroy when a process is exiting. More likely the connection attempt is hanging due to network issues so the process is blocking and the close events do not get executed.
SQLServer connection failures can take 2 minutes to timeout. Other network connection operations can take as much time. In rare instances a connection attempt can hang indefinitely which indicates a configuration error or a failure of some kind. In my experience these are hard to troubleshoot without advanced methods. The first step is to isolate the issue by using a loop in a simple script to try to force this. Often this fails. Network sniffers can trap the history of connections and produce detailed tracing that can help. These issues are almost never related to any application. They are network and server relative.
This topic is 3 years and 6 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.