Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winforms VB application with Single Instance setting crashes for multiple users on terminal server #11232

Open
Olina-Zhang opened this issue Apr 18, 2024 · 3 comments · May be fixed by #11258
Open
Labels
area-VisualBasic 🪲 bug Product bug (most likely) blocking-migration An issue that is preventing the developer from migrating from .NET Framework or earlier .NET Security Issues of runtime code vulnerabilities or unintentional exposing customer data side effect tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework
Milestone

Comments

@Olina-Zhang
Copy link
Member

Olina-Zhang commented Apr 18, 2024

.NET version

.Net 9.0 SDK: 9.0.100-preview.4.24217.27

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No, repro in .Net 8

Issue description

Creating a Winforms .Net 9 or 8 VB application with setting "single instance application" to true, put it on a terminal server, more users with permission to work on this server using RDP. The first user starts the program just fine, the second user start the same app and it crashes on startup.

Here is the log when it is reproduced:

Application: VBSingleInstance_NET9.exe
CoreCLR Version: 9.0.24.21505
.NET Version: 9.0.0-preview.4.24215.5
Description: The process was terminated due to an unhandled exception.
Exception Info: Microsoft.VisualBasic.ApplicationServices.CantStartSingleInstanceException: This single-instance application could not connect to the original instance.
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at VBSingleInstance_NET9.My.MyApplication.Main(String[] Args) in :line 83

Steps to reproduce

  1. Create a Winforms VB .NET application
  2. In Solution Explorer window, show all files, find Application.Designer.vb file, set IsSingleInstance to true
    image
  3. Build this application
  4. Put this applicaiton to a prepared server machine with multiple users access
  5. First user to log in this terminal server machine by RDP, launch this application
  6. Second user to log in this terminal server machine by RDP, launch this application too

MoreInfo: this is a customer feedback: https://developercommunity.visualstudio.com/t/NET-8-single-instance-winforms-crashes-/10634133

@Olina-Zhang Olina-Zhang added the untriaged The team needs to look at this issue in the next triage label Apr 18, 2024
@elachlan
Copy link
Contributor

Duplicate of #3715

@elachlan elachlan marked this as a duplicate of #3715 Apr 23, 2024
@elachlan
Copy link
Contributor

@Olina-Zhang the exception is probably caused by the fact that the named pipe uses PipeOptions.CurrentUserOnly. So it can't connect to other users named pipes. Which is what we want. My suggested fix in #11258 should mitigate this issue.

@elachlan elachlan linked a pull request Apr 23, 2024 that will close this issue
@merriemcgaw
Copy link
Member

merriemcgaw commented Apr 24, 2024

@KlausLoeffelmann would you be able to look at the changes?
@elachlan, thank you so much for the PR!

We'll want to make sure that security (@Shyam-Gupta and @GrabYourPitchforks ) are also happy the change.

@merriemcgaw merriemcgaw added this to the .NET 9.0 milestone Apr 24, 2024
@merriemcgaw merriemcgaw added Security Issues of runtime code vulnerabilities or unintentional exposing customer data side effect and removed untriaged The team needs to look at this issue in the next triage labels Apr 24, 2024
@elachlan elachlan added tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework blocking-migration An issue that is preventing the developer from migrating from .NET Framework or earlier .NET 🪲 bug Product bug (most likely) labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-VisualBasic 🪲 bug Product bug (most likely) blocking-migration An issue that is preventing the developer from migrating from .NET Framework or earlier .NET Security Issues of runtime code vulnerabilities or unintentional exposing customer data side effect tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants