From 22668d1e618d4e3d597c55e424ce7f612d91fa43 Mon Sep 17 00:00:00 2001 From: Lachlan Ennis <2433737+elachlan@users.noreply.github.com> Date: Wed, 24 Apr 2024 08:41:08 +1000 Subject: [PATCH] Fixes #3715 - Add currentUserSID to GetApplicationInstanceID for use in TryCreatePipeServer to avoid system wide blocking. Used in conjunction with PipeOptions.CurrentUserOnly --- .../WindowsFormsApplicationBase.vb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb index f03e1f494e7..5f10f4c0bb1 100644 --- a/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb +++ b/src/Microsoft.VisualBasic.Forms/src/Microsoft/VisualBasic/ApplicationServices/WindowsFormsApplicationBase.vb @@ -1006,28 +1006,26 @@ Namespace Microsoft.VisualBasic.ApplicationServices ''' ''' Generates the name for the remote singleton that we use to channel multiple instances - ''' to the same application model thread. + ''' to the same application model thread for the current user. ''' ''' A string unique to the application that should be the same for versions of ''' the application that have the same Major and Minor Version Number ''' ''' If GUID Attribute does not exist fall back to unique ModuleVersionId Private Shared Function GetApplicationInstanceID(ByVal Entry As Assembly) As String + Dim guidAttribute As GuidAttribute = Entry.GetCustomAttribute(Of GuidAttribute)() + Dim currentUserSID As String = Principal.WindowsIdentity.GetCurrent().User.Value - Dim guidAttrib As GuidAttribute = Entry.GetCustomAttribute(Of GuidAttribute)() - - If guidAttrib IsNot Nothing Then - + If guidAttribute IsNot Nothing Then Dim version As Version = Entry.GetName.Version - If version IsNot Nothing Then - Return $"{guidAttrib.Value}{version.Major}.{version.Minor}" + Return $"{guidAttribute.Value}{version.Major}.{version.Minor}-{currentUserSID}" Else - Return guidAttrib.Value + Return $"{guidAttribute.Value}-{currentUserSID}" End If End If - Return Entry.ManifestModule.ModuleVersionId.ToString() + Return $"{Entry.ManifestModule.ModuleVersionId}-{currentUserSID}" End Function End Class End Namespace