vklachkov / windows-virtualdesktopindicator

Virtual desktop indicator for system tray
MIT License
102 stars 13 forks source link

Does not auto start at boot #17

Open gaurakshay opened 2 years ago

gaurakshay commented 2 years ago

I'd like to start by thanking you for this tool. I've setup for the app to start at startup. However, this is the error that I see in the event viewer:

Log Name:      Application
Source:        .NET Runtime
Date:          3/21/2022 11:23:08
Event ID:      1026
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      DESKTOP-KLDMP0F
Description:
Application: VirtualDesktopIndicator.exe
CoreCLR Version: 6.0.322.12309
.NET Version: 6.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for 'VirtualDesktopIndicator.Config.UserConfig' threw an exception.
 ---> System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\system32\vdi_config.json' is denied.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.File.WriteAllText(String path, String contents)
   at VirtualDesktopIndicator.Config.UserConfig.Save() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 51
   at VirtualDesktopIndicator.Config.UserConfig.LoadFromFile(String path) in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 38
   at VirtualDesktopIndicator.Config.UserConfig..cctor() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 8
   --- End of inner exception stack trace ---
   at VirtualDesktopIndicator.Config.UserConfig.get_Current() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 8
   at VirtualDesktopIndicator.Components.DesktopNotifyIcon.get_FontName() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Components\DesktopNotifyIcon.cs:line 77
   at VirtualDesktopIndicator.Components.DesktopNotifyIcon..ctor(IVirtualDesktopManager virtualDesktop) in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Components\DesktopNotifyIcon.cs:line 109
   at VirtualDesktopIndicator.Program.Main() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Program.cs:line 15

Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name=".NET Runtime" />
    <EventID Qualifiers="0">1026</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2022-03-21T16:23:08.2517747Z" />
    <EventRecordID>39490</EventRecordID>
    <Correlation />
    <Execution ProcessID="21120" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>DESKTOP-KLDMP0F</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Application: VirtualDesktopIndicator.exe
CoreCLR Version: 6.0.322.12309
.NET Version: 6.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for 'VirtualDesktopIndicator.Config.UserConfig' threw an exception.
 ---&gt; System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\system32\vdi_config.json' is denied.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.File.WriteAllText(String path, String contents)
   at VirtualDesktopIndicator.Config.UserConfig.Save() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 51
   at VirtualDesktopIndicator.Config.UserConfig.LoadFromFile(String path) in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 38
   at VirtualDesktopIndicator.Config.UserConfig..cctor() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 8
   --- End of inner exception stack trace ---
   at VirtualDesktopIndicator.Config.UserConfig.get_Current() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Config\UserConfig.cs:line 8
   at VirtualDesktopIndicator.Components.DesktopNotifyIcon.get_FontName() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Components\DesktopNotifyIcon.cs:line 77
   at VirtualDesktopIndicator.Components.DesktopNotifyIcon..ctor(IVirtualDesktopManager virtualDesktop) in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Components\DesktopNotifyIcon.cs:line 109
   at VirtualDesktopIndicator.Program.Main() in C:\Users\Valery\Desktop\windows-virtualdesktopindicator\src\Program.cs:line 15
</Data>
  </EventData>
</Event>

This error log is followed by another error log:

Log Name:      Application
Source:        Application Error
Date:          3/21/2022 11:23:08
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      DESKTOP-KLDMP0F
Description:
Faulting application name: VirtualDesktopIndicator.exe, version: 1.0.0.0, time stamp: 0x61735063
Faulting module name: KERNELBASE.dll, version: 10.0.22000.527, time stamp: 0x71a5cb5d
Exception code: 0xe0434352
Fault offset: 0x000000000004478c
Faulting process id: 0x5280
Faulting application start time: 0x01d83d3ff345669f
Faulting application path: C:\VirtualDesktopIndicator\VirtualDesktopIndicator.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: fd13f733-59bf-4c71-b5a3-6cdbb00460cd
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2022-03-21T16:23:08.4236494Z" />
    <EventRecordID>39491</EventRecordID>
    <Correlation />
    <Execution ProcessID="21268" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>DESKTOP-KLDMP0F</Computer>
    <Security />
  </System>
  <EventData>
    <Data>VirtualDesktopIndicator.exe</Data>
    <Data>1.0.0.0</Data>
    <Data>61735063</Data>
    <Data>KERNELBASE.dll</Data>
    <Data>10.0.22000.527</Data>
    <Data>71a5cb5d</Data>
    <Data>e0434352</Data>
    <Data>000000000004478c</Data>
    <Data>5280</Data>
    <Data>01d83d3ff345669f</Data>
    <Data>C:\VirtualDesktopIndicator\VirtualDesktopIndicator.exe</Data>
    <Data>C:\WINDOWS\System32\KERNELBASE.dll</Data>
    <Data>fd13f733-59bf-4c71-b5a3-6cdbb00460cd</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>
Flaflo commented 2 years ago

Thank you for reporting, I know what the problem is and will try to fix it asap