Quasar icon indicating copy to clipboard operation
Quasar copied to clipboard

System.NullReferenceException: "StartupManager" StartupItems was null.

Open BurntDog opened this issue 4 years ago • 6 comments

Clicking Quit will show errors then close apps one at a time client first server last Debug Mode: https://prnt.sc/wbsaoq Exception thrown on Line 140 "foreach (var item in StartupItems)"

https://prnt.sc/wbjer1 https://prnt.sc/wbjg1c https://prnt.sc/wbjgzg

Describe the bug Startup manager will crash before it populates the form

To Reproduce Steps to reproduce the behavior: Try to view Startup Manager Crashes with errors

Expected behavior Startup Manager should open and populate

System

  • Server OS: [e.g. Windows 10]
  • Client OS: [e.g. Windows 10]
  • Server installed .NET Framework version: v4.8]
  • Client installed .NET Framework version: v4.8]
  • Quasar Version: 1.4.0.0 Newest available
  • Build configuration: Release

Installed

dotnet-sdk-5.0.101-win-x64 <--- installed from Visual Studio ndp48-devpack-enu.exe

on both Client/Server Windows10 OS


Additional context ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at Quasar.Server.Forms.FrmStartupManager.StartupItemsChanged(Object sender, List`1 startupItems)

************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

Quasar Assembly Version: 1.4.0.0 Win32 Version: 1.4.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Quasar.exe

System Assembly Version: 4.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

Quasar.Common Assembly Version: 1.4.0.0 Win32 Version: 1.4.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Quasar.Common.DLL

System.Management Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll

Open.Nat Assembly Version: 1.0.0.0 Win32 Version: 1.1.0.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Open.Nat.DLL

System.Security Assembly Version: 4.0.0.0 Win32 Version: 4.8.4261.0 built by: NET48REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll

Accessibility Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

System.Data.SqlXml Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Data.SqlXml/v4.0_4.0.0.0__b77a5c561934e089/System.Data.SqlXml.dll

System.Configuration.Install Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration.Install/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.Install.dll

protobuf-net Assembly Version: 2.4.0.0 Win32 Version: 2.4.6.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/protobuf-net.DLL

Anonymously Hosted DynamicMethods Assembly Assembly Version: 0.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll

Mono.Cecil Assembly Version: 0.11.2.0 Win32 Version: 0.11.2.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Mono.Cecil.DLL

Vestris.ResourceLib Assembly Version: 2.1.0.0 Win32 Version: 2.1.0.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Vestris.ResourceLib.DLL

Gma.System.MouseKeyHook Assembly Version: 5.6.130.0 Win32 Version: 5.6.130.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Gma.System.MouseKeyHook.DLL

************** Exception Text ************** System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext() at System.Windows.Forms.Application.ExitInternal() at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t) at System.Windows.Forms.Control.InvokeMarshaledCallbacks() at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

Quasar Assembly Version: 1.4.0.0 Win32 Version: 1.4.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Quasar.exe

System Assembly Version: 4.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

Quasar.Common Assembly Version: 1.4.0.0 Win32 Version: 1.4.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Quasar.Common.DLL

System.Management Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll

Open.Nat Assembly Version: 1.0.0.0 Win32 Version: 1.1.0.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Open.Nat.DLL

System.Security Assembly Version: 4.0.0.0 Win32 Version: 4.8.4261.0 built by: NET48REL1LAST_B CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll

Accessibility Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

System.Data.SqlXml Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Data.SqlXml/v4.0_4.0.0.0__b77a5c561934e089/System.Data.SqlXml.dll

System.Configuration.Install Assembly Version: 4.0.0.0 Win32 Version: 4.8.3752.0 built by: NET48REL1 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration.Install/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.Install.dll

protobuf-net Assembly Version: 2.4.0.0 Win32 Version: 2.4.6.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/protobuf-net.DLL

Anonymously Hosted DynamicMethods Assembly Assembly Version: 0.0.0.0 Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll

Mono.Cecil Assembly Version: 0.11.2.0 Win32 Version: 0.11.2.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Mono.Cecil.DLL

Vestris.ResourceLib Assembly Version: 2.1.0.0 Win32 Version: 2.1.0.0 CodeBase: file:///C:/Users/cyclo/Desktop/Quasar-master/bin/Release/net452/Vestris.ResourceLib.DLL

BurntDog avatar Dec 28 '20 07:12 BurntDog

OK, this is not a proper fix but a Band-Aid Code needs a proper fix because a Exception is thrown when there is no data at all to be read in these locations:

lstStartupItems.Groups.Add(new ListViewGroup("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run")

        lstStartupItems.Groups.Add(new ListViewGroup("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce")
 
        lstStartupItems.Groups.Add(new ListViewGroup("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
      
        lstStartupItems.Groups.Add(new ListViewGroup("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce")

        lstStartupItems.Groups.Add(new ListViewGroup("%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup")

=================================================================================== The Quick and dirty fix/Band-Aid, below

private void StartupItemsChanged(object sender, List<StartupItem> StartupItems) { lstStartupItems.Items.Clear(); try { foreach (var item in StartupItems) { var i = lstStartupItems.Groups.Cast<ListViewGroup>().First(x => (StartupType)x.Tag == item.Type); ListViewItem lvi = new ListViewItem(new[] { item.Name, item.Path }) { Group = i, Tag = item }; lstStartupItems.Items.Add(lvi); } } catch (NullReferenceException) {

        }
        ///foreach (var item in StartupItems)

            ///{
            ///var i = lstStartupItems.Groups.Cast<ListViewGroup>().First(x => (StartupType)x.Tag == item.Type);
            ///ListViewItem lvi = new ListViewItem(new[] {item.Name, item.Path}) {Group = i, Tag = item};
            ///lstStartupItems.Items.Add(lvi);
        ///}
    }

I wish I was better then a good Script kiddie but, that's my reality I just don't have the brain power I guess. Hope this helps some of you until a proper fix comes..

BurntDog avatar Dec 30 '20 23:12 BurntDog

"Made separate Bug report for this" Almost forgot to mention, when you try to add a startup entry in Path field using "Startup Manager" it won't let you use special characters ie.. : \ " you're forced to copy and paste. "Made separate Bug report for this"

BurntDog avatar Dec 31 '20 00:12 BurntDog

"Made separate Bug report for this" I noticed that Startup Manger does not search these locations. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce Will these be added back in future release? "Made separate Bug report for this"

BurntDog avatar Dec 31 '20 23:12 BurntDog

I noticed that Startup Manger does not search these locations. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce Will these be added back in future release?

Please create a separate bug report for this.

MaxXor avatar Jan 01 '21 18:01 MaxXor

I noticed that Startup Manger does not search these locations. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\RunOnce Will these be added back in future release?

Please create a separate bug report for this.

OK, thanks and Happy New Year @MaxXor

BurntDog avatar Jan 01 '21 18:01 BurntDog

Closed by mistake....

BurntDog avatar Jan 01 '21 18:01 BurntDog