dotnet / dotnet/winforms

Single instance app doesn't work when same app is in different folders

Open
#11,365 4 comments 0 reactions 1 assignee Claimed by @KlausLoeffelmann View on GitHub
:construction: work in progress area-VisualBasic tenet-compatibility
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

.NET 8.0.204

### Did it work in .NET Framework?

Yes

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

_No response_

### Issue description

Single instance app doesn't work when same app is in different folders

### Steps to reproduce

1. Create a WinForm Application for .NET 8.0 (e.g.: WinFormsApp1)
2. Implement the Single Instance Application using the **Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase** class;
3. Build the Project and copy the bin\Debug\net8.0-windows folder for 2 diferent folders (e.g.: FolderA and FolderB);
4. Launch the WinFormsApp1.exe from FolderA and keep it opened;
5. Try to launch the WinFormsApp1.exe from FolderA again: Verify that it is detected that the WinFormsApp1.exe is already opened (PASS!);
6. Now, Launch the WinFormsApp1.exe from FolderB: Verify that WinFormsApp1.exe is launched and 2 instances of the WinFormsApp1.exe are now opened. One from FolderA and other from FolderB (FAIL);

**IMPORTANT NOTES**
- This issue is NOT reproducible when the same App is compiled to **.NET Framework 4.8**;

Here is the code exemple to reproduce this issue: [WinFormsApp1.zip](https://github.com/dotnet/winforms/files/15299055/WinFormsApp1.zip)

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.