Jump to content

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'defaultValue < minValue')


lightknight
Go to solution Solved by BoltBait,

Recommended Posts

(joke) Yes, I finally got PDN to crash! (/joke). But on a more serious note, it's possibly my crappy plugin code that's causing this...actually, it's most definitely my code (only happens when I run my plugin via Preview Effect...while it seems to work when I just run it in Debug mode). But the crash reporter says to submit it, so I am.

 

Here's the relevant text (I uploaded the complete log as well):

 

This text file was created because paint.net crashed. Please e-mail this to <email removed> so we can diagnose and fix the problem.

Application version: paint.net 4.3.12 (Stable 4.312.8267.29064)
Time of crash: 9/19/2022 12:26:16 AM
Application uptime: 00:01:12.5027804
Application state: Running
Working set: 805,796 KiB
Handles and threads: 1637 handles, 149 threads, 199 gdi, 276 user
Install type: Classic
Application directory: C:\Program Files\paint.net
Current directory: C:\Program Files\paint.net
Install directory: C:\Program Files\paint.net
OS Version: Windows 11 Pro for Workstations 10.0.22000.0 x64
.NET version: .NET 6.0.8 x64
Processor: "AMD Ryzen Threadripper 3990X 64-Core Processor" @ ~2918MHz (32C/64T, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, AVX, AVX2)
Physical memory: 262005 MB
Video card: NVIDIA GeForce RTX 3090 (v:10DE, d:2204, r:161), Microsoft Basic Render Driver (v:1414, d:8C, r:0)
Hardware acceleration: True (default: True)
Remote session: no
Pointers: none
UI animations: True
UI DPI: 192 dpi (2.00x scale)
UI theme: VisualStyleCategory=Aero, EffectiveTheme=Aero, DWM=yes, AeroColorScheme=Dark, ThemeFileName=Aero.msstyles
Updates: True, 9/19/2022 (journal: ShouldCheckForUpdate, CheckedForUpdate)
Locale: pdnr.c: en-US, hklm: en-US, hkcu: en-US, cc: en-US, cuic: en-US
Flags:

Exception details:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'defaultValue < minValue')
   at PaintDotNet.PropertySystem.ScalarProperty`1..ctor(Object name, T defaultValue, T minValue, T maxValue, Boolean readOnly, ValueValidationFailureResult vvfResult) in D:\src\pdn\src_4_3_x\Base\PropertySystem\ScalarProperty`1.cs:line 128
   at PreviewEffectEffect.PreviewEffectEffectPlugin.OnCreatePropertyCollection()
   at PaintDotNet.Effects.PropertyBasedEffect.PaintDotNet.Effects.IPropertyBasedEffectHost.OnCreatePropertyCollection() in D:\src\pdn\src_4_3_x\Effects\PropertyBasedEffect.cs:line 40
   at PaintDotNet.Effects.PropertyBasedEffect.CreatePropertyCollection() in D:\src\pdn\src_4_3_x\Effects\PropertyBasedEffect.cs:line 35
   at PaintDotNet.Effects.PropertyBasedEffectHandler`1.RelayCreateConfigDialog() in D:\src\pdn\src_4_3_x\Effects\PropertyBasedEffectHandler.cs:line 33
   at PaintDotNet.Effects.PropertyBasedEffect.CreateConfigDialog() in D:\src\pdn\src_4_3_x\Effects\PropertyBasedEffect.cs:line 48
   at PaintDotNet.Effects.CodeLabConfigDialog.RunEffectWithDialog()
   at PaintDotNet.Effects.CodeLabConfigDialog.RunCommand()
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

 

Once again, I will remind you that this only happens when I choose Preview Effect in Codelab. The plugin seems to be working otherwise though (I base my assumption on the fact that it seems to generate Debug output just fine). And this crash is reproducible (this the third time I got PDN to crash doing the same thing).

 

 

pdncrash.3.log

Link to comment
Share on other sites

  • Solution
15 minutes ago, lightknight said:

Specified argument was out of the range of valid values. (Parameter 'defaultValue < minValue')

 

Your effect code has specified a default value that is outside of the range of the control.  

 

In your script, look for the UI block:

 

#region UICode
IntSliderControl Amount1 = 0; // [1,100] Radius
#endregion

 

If this is not a CodeLab script, but a visual studio project, your UI code will look like this:

 

protected override PropertyCollection OnCreatePropertyCollection()
{
    List<Property> props = new List<Property>();

    props.Add(new Int32Property(PropertyNames.Amount1, 0, 1, 100));

 

This control will cause the problem:  The default value is "0" and the minimum allowed value is "1".  (The maximum value is "100".)

 

In this case, to fix the problem, just change the "0" to "1" or any other value that sits between 1 and 100.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...