ImageGlass icon indicating copy to clipboard operation
ImageGlass copied to clipboard

Crop button triggers Null Reference Exception

Open alessandro-antonelli opened this issue 1 year ago • 10 comments

System information:

Version: ImageGlass v9.0.8.1208 Release code: kobe OS: Microsoft Windows NT 10.0.19045.0 64-bit

To Reproduce

Steps to reproduce the behavior:

  1. Open an image with ImageGlass
  2. Press "c" or click on the crop button in the toolbar

Expected behavior:

The crop commands are displayed.

Actual behavior:

The following error message is shown:

Error:

Object reference not set to an instance of an object.
----------------------------------------------------

System.NullReferenceException: Object reference not set to an instance of an object.
   at ImageGlass.FrmCrop.OnUpdateHeight(Boolean performUpdate) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 142
   at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 93
   at System.Windows.Forms.Form.WmDpiChanged(Message& m)
   at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 200
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

If you click on the button "Continue" each time, the error is displayed again a second time, a third time, a fourth time, a fifth time. Then one last click on "continue" finally causes the crop commands to be displayed as desired.

Screenshots:

image

Additional context:

Already tried to use "Repair install" in control panel, but it did not solve the issue.

alessandro-antonelli avatar Dec 05 '23 19:12 alessandro-antonelli

Hi @alessandro-antonelli Can you please send a video? I cannot reproduce this issue.

d2phap avatar Dec 14 '23 10:12 d2phap

Hi @alessandro-antonelli Can you please send a video? I cannot reproduce this issue.

Hi @d2phap , please check the video below

https://github.com/d2phap/ImageGlass/assets/7611912/724f906e-44b4-4db4-8e1b-1420c6653365

sdsy888 avatar Jan 19 '24 04:01 sdsy888

Can you check if it's fixed in ImageGlass 9.0.10.201

d2phap avatar Jan 31 '24 13:01 d2phap

Still not fixed, but the stack trace in the error message has changed.

Error message before updating:

Version: ImageGlass v9.0.9.1230 Release code: kobe OS: Microsoft Windows NT 10.0.19045.0 64-bit


Error:

Object reference not set to an instance of an object.

System.NullReferenceException: Object reference not set to an instance of an object. at ImageGlass.FrmCrop.OnUpdateHeight(Boolean performUpdate) in D:_GITHUB@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 142 at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:_GITHUB@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 93 at System.Windows.Forms.Form.WmDpiChanged(Message& m) at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:_GITHUB@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 200 at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

Error message after updating:

Version: ImageGlass v9.0.10.201 Release code: kobe Magick.NET: Magick.NET Q16-HDRI-OpenMP x64 netstandard21 13.5.0 WebView2 Runtime: 120.0.2210.144 OS: Microsoft Windows NT 10.0.19045.0 64-bit


Error:

Object reference not set to an instance of an object.

System.NullReferenceException: Object reference not set to an instance of an object. at ImageGlass.FrmCrop.ApplyTheme(Boolean darkMode, Nullable`1 style) in D:_GITHUB@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 65 at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:_GITHUB@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 95 at System.Windows.Forms.Form.WmDpiChanged(Message& m) at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:_GITHUB@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 200 at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

alessandro-antonelli avatar Jan 31 '24 13:01 alessandro-antonelli

Thanks @alessandro-antonelli for the info, I will try to check again.

d2phap avatar Jan 31 '24 13:01 d2phap

I can confirm that this is still happening with the 9.17.7.627 build.

Also, with the aforementioned error dialog, if the Continue is clicked 4 times, the crop tool finally appears, but the dialog box is malformed.

HTH, MadDogDean

image

image

image

MadDogDean avatar Jul 12 '24 05:07 MadDogDean

Can help me check if this happens to Color Picker tool as well?

d2phap avatar Jul 12 '24 05:07 d2phap

Yes it also happens with Color Picker.

Again, I can click Continue 4 times and then a malformed Color Picker dialog box appears.

I did notice that the error messages are slightly different in each instance.

This is the error message on the Crop tool:

Version: ImageGlass v9.1.7.627
Release code: kobe
Magick.NET: Magick.NET Q16-HDRI-OpenMP x64 netstandard21 13.9.1
WebView2 Runtime: 126.0.2592.102
OS: Microsoft Windows NT 10.0.22631.0 64-bit

----------------------------------------------------
Error:

Object reference not set to an instance of an object.
----------------------------------------------------

System.NullReferenceException: Object reference not set to an instance of an object.
   at ImageGlass.FrmCrop.ApplyTheme(Boolean darkMode, Nullable`1 style) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 65
   at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 95
   at System.Windows.Forms.Form.WmDpiChanged(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 221
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

This is the error message on the Color Picker tool:

Version: ImageGlass v9.1.7.627
Release code: kobe
Magick.NET: Magick.NET Q16-HDRI-OpenMP x64 netstandard21 13.9.1
WebView2 Runtime: 126.0.2592.102
OS: Microsoft Windows NT 10.0.22631.0 64-bit

----------------------------------------------------
Error:

Object reference not set to an instance of an object.
----------------------------------------------------

System.NullReferenceException: Object reference not set to an instance of an object.
   at ImageGlass.FrmColorPicker.OnUpdateHeight(Boolean performUpdate) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmColorPicker.cs:line 152
   at ImageGlass.FrmColorPicker.OnDpiChanged(DpiChangedEventArgs e) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmColorPicker.cs:line 90
   at System.Windows.Forms.Form.WmDpiChanged(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 221
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

image

MadDogDean avatar Jul 12 '24 06:07 MadDogDean

BTW, This is my Windows version

image :

MadDogDean avatar Jul 12 '24 06:07 MadDogDean

Today I noticed that the error generated by the Crop & Color Picker tools happens with images opened into ImageGlass. If an image is copied to the clipboard (right-click on image and Copy in File Explorer or copied from any other resource, browser, etc) and then pasted into IG, the Crop or Color Picker error is not generated. The Dialog boxes are not malformed and all function as expected

MadDogDean avatar Jul 13 '24 05:07 MadDogDean