[GH-ISSUE #601] App crashes on load trying to access AccountDomainSid #497

Closed
opened 2026-02-26 09:31:39 +03:00 by kerem · 2 comments
Owner

Originally created by @robeving on GitHub (Feb 26, 2020).
Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/601

github.com/NickeManarin/ScreenToGif@55b6ad12bd/ScreenToGif/App.xaml.cs (L81)

So it looks like you check user for null but not AccountDomainSid. AccountDomainSid can actually be null as well which causes an exception when you run the app.

Fix is to change to user.Value.ToString()

var mutexName = (user != null ? user.Value.ToString() : Environment.UserName) + "_" + location;
Originally created by @robeving on GitHub (Feb 26, 2020). Original GitHub issue: https://github.com/NickeManarin/ScreenToGif/issues/601 https://github.com/NickeManarin/ScreenToGif/blob/55b6ad12bd5792e3171aa45a12184e05bce993fd/ScreenToGif/App.xaml.cs#L81 So it looks like you check user for null but not AccountDomainSid. AccountDomainSid can actually be null as well which causes an exception when you run the app. Fix is to change to user.Value.ToString() ``` var mutexName = (user != null ? user.Value.ToString() : Environment.UserName) + "_" + location; ```
kerem 2026-02-26 09:31:39 +03:00
Author
Owner

@NickeManarin commented on GitHub (Feb 26, 2020):

Ok, I'm going to replace with:

var mutexName = (user?.Value ?? Environment.UserName) + "_" + location;

Thanks.

<!-- gh-comment-id:591471844 --> @NickeManarin commented on GitHub (Feb 26, 2020): Ok, I'm going to replace with: `var mutexName = (user?.Value ?? Environment.UserName) + "_" + location;` Thanks.
Author
Owner

@NickeManarin commented on GitHub (Feb 26, 2020):

Fixed. A new version will be released shortly.
v2.21.1

<!-- gh-comment-id:591476007 --> @NickeManarin commented on GitHub (Feb 26, 2020): Fixed. A new version will be released shortly. v2.21.1
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenToGif#497
No description provided.