Unhandled exception randomly received
A lightweight and easy-to-use password manager
Brought to you by:
dreichl
I randomly receive an Unhandled exception, exception text as follows
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Disposed 'Cursor' can no longer be used.'.
at System.Windows.Forms.Cursor.get_Handle()
at System.Windows.Forms.RichTextBox.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I'm on KeePass 2.50 & Win 11 Pro, 21H2 b22567.100
As it can be seen from the stack trace, the exception occurs in .NET code; there's no KeePass code involved.
My suggestion would be to try repairing the .NET Framework using the following tool:
https://www.microsoft.com/en-us/download/details.aspx?id=30135
Best regards,
Dominik
As can be seen the issue is Windows.Forms. This is probably a .NET issue not KeePass.
Try a DISM and SFC repair [1], then a .NET repair [2].
cheers, Paul
p.s. please post text directly. Having to download a doc file, check it, open it, delete afterwards is a pain.
[1] https://www.askwoody.com/forums/topic/message-after-bootup/#post-2421061
[2] https://www.microsoft.com/en-gb/download/details.aspx?id=30135
I have turned off .NET in Windows Features but am still receiving the error as below
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
** Exception Text **
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Disposed 'Cursor' can no longer be used.'.
at System.Windows.Forms.Cursor.get_Handle()
at System.Windows.Forms.RichTextBox.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.9022.1 built by: NET481REL1
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
KeePass
Assembly Version: 2.50.0.20886
Win32 Version: 2.50.0.0
CodeBase: file:///C:/Program%20Files/KeePass%20Password%20Safe%202/KeePass.exe
System
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9022.1 built by: NET481REL1
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.9022.1 built by: NET481REL1
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.9022.1 built by: NET481REL1
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.9022.1 built by: NET481REL1
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.9022.1 built by: NET481REL1
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.9022.1 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9022.1 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
System.Security
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9022.1 built by: NET481REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
KeePass.XmlSerializers
Assembly Version: 2.50.0.20886
Win32 Version: 2.50.0.20886
CodeBase: file:///C:/Program%20Files/KeePass%20Password%20Safe%202/KeePass.XmlSerializers.DLL
** JIT Debugging **
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
</system.windows.forms></configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Please can you advise further?
You can't turn off .NET, it's part of Windows. Repairing it is the usual remedy.
cheers, Paul
So what happens when I turn off .NET from the control panel, see screenshot?
I've previously tried a .NET repair but it made no difference
In this dialog, you can remove .NET 3.5 and some additional things for .NET 4.8. Even if both options are turned off, .NET 4.8 continues to be installed.
Best regards,
Dominik
I've also got this across at least two machines on the insider builds (22572 - released today and 22567).
I've done the DISM and SFC repairs, and the .NET troubleshooter and no issues found by anything, yet the problem still happens.
I can reproduce it every time by running the mouse over the bottom of the KeePass main window (Entry View portion of the window).
Do you have any plug-ins? Try it without them.
Try a clean copy of the portable (zip) version with an enforced config file set to use new settings.
Place the attached txt file in the same location as the portable KeePass.exe and rename it to KeePass.config.xml.
Run KeePass.exe.
cheers, Paul
No plug-ins
Are you using any special cursor (e.g. a colored cursor)? If so, try using the regular one.
Best regards,
Dominik
No special cursor
Clean config?
Also have no special cursor.
Downloaded the portable version, extracted and then grabbed the clean config file.
Renamed to KeePass.config.enforced.xml and dropped into the same folder I extracted the portable version to.
Loaded up a DB file and selected an entry, then ran the mouse over the Entry View portion of the window for a few seconds and the same error still came up:
Last edit: Vinnie-NZ 2022-03-11
Try a previous version of KeePass.
cheers, Paul
I can pin it down to when you roll over a link, in my case that is a group name (General) and/or a URL
When you roll over a URL you get a tooltip popup.
Try editing an entry and roll over one of the icons. Yo should get a tooltip.
cheers, Paul
In edit mode a roll over one of the icons does indeed give me a tooltip
So from what you are saying the issue appears to be an exception instead of a tool tip in view entry mode when rolling over group/URL
Last edit: Robert Routledge 2022-03-11
Rolling over a group highlights the group name but doesn't produce a tooltip. Same as rolling over a field heading or entry.
I can't reproduce this on my machines so I don't know what causes it, apart from .NET.
Do you have any unusual programs installed?
cheers, Paul
If I can find a way of uninstalling .NET I'll retest to prove .NET
Does KeePass 2.50 need .NET 4.8 to run?
What's unusual in this context, please be more specific?
Last edit: Robert Routledge 2022-03-11
If you manage to remove .NET, KeePass won't run.
Non-office / browser software
cheers, Paul
Last edit: Paul 2022-03-11
Yes of course I have!
Most people have
What's your point?
What Windows versions are you testing against?
Last edit: Robert Routledge 2022-03-11
Something interfering?
Windows 10, NET 4.8, KeePass 2.50
You need to test against Windows 11!
Windows 11 was released to the general public on October 5, 2021
I clearly stated at the start I was using Win 11
You'll be unlikely to reproduce the bug unless you're using the same baseline
Suggesting that users are at fault for using 'unusual programs' is not acceptable
Your scope of testing is inadequate and needs to be addressed