dotnet / dotnet/winforms

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

Open
#11,232 3 comments 0 reactions 0 assignees View on GitHub
:beetle: bug :construction: work in progress area-VisualBasic blocking-migration security tenet-compatibility
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .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](https://github.com/dotnet/winforms/assets/26474449/33ab17a5-3abe-4e2a-b8ba-1980106fb482)
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.