Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: TestForm app: KCombobox from main.cs causes a crash #1462

Closed
giduac opened this issue May 14, 2024 · 14 comments
Closed

[Bug]: TestForm app: KCombobox from main.cs causes a crash #1462

giduac opened this issue May 14, 2024 · 14 comments
Labels
bug Something isn't working regression Something was working in a previous release, but isn't working now.
Milestone

Comments

@giduac
Copy link

giduac commented May 14, 2024

Describe the bug
Main.cs (form Main) contains a KCombobox that causes a throw in the designer and at runtime.

To Reproduce
Steps to reproduce the behavior:

  1. Create a test branch from alpha and switch to it.
  2. add a button to startscreen that lauches main(.cs) form
  3. Build and run

Expected behavior
N/A
All other forms launched from startscreen have no issues

Desktop (please complete the following information):

  • OS: Win11
  • Branch from Alpha for testing this
  • Frameworks tested: 4.8 / 6.0

Additional context

  • It is not related to the work on warnings. Tests with branches from before also produce this error.
  • Found some articles on Stackoverflow and web-searches about this error (pretty identical) without the use of Krypton.

Narrowed it further down to the font & size used by the KManager basefont:

Both StartScreen and Main have a KManager attached both with default base font setting:

this.kryptonManager1.BaseFont = 
    new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  • Removing the line of code from the designer file also removed the error.

  • Changing the font size in the designer file from 9F to 9.01F removes the error.

  • Changing the font to Verdana and leaving the size at 9F removes the error.

  • Reversing it brings back the error.

  • Also observed when changing the font size of the KCombobox on main form. The error goes away.

  • Removing the KCombobox from the form also removes the error.

  • Assigning a font to KCombobox StateCommon.ComboBox.Content.Font removes he error.

  • Added: as stated earlier, it is not related to a specific theme.

After these findings it looks something in Dotnet and not related to or produced by KToolkit.

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Parameter is not valid.
   at System.Drawing.Font.GetHeight(Graphics graphics)
   at System.Drawing.Font.GetHeight()
   at System.Drawing.Font.get_Height()
   at System.Windows.Forms.Control.get_FontHeight()
   at System.Windows.Forms.ComboBox.get_PreferredHeight()
   at System.Windows.Forms.ComboBox.get_CreateParams()
   at System.Windows.Forms.Control.ScaleControl(SizeF factor, BoundsSpecified specified)
   at System.Windows.Forms.ComboBox.ScaleControl(SizeF factor, BoundsSpecified specified)
   at System.Windows.Forms.Control.ScaleControl(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.Control.Scale(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.Control.ScaleChildControls(SizeF includedFactor, SizeF excludedFactor, Control requestingControl, Boolean updateWindowFontIfNeeded)
   at System.Windows.Forms.Control.Scale(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.Control.ScaleChildControls(SizeF includedFactor, SizeF excludedFactor, Control requestingControl, Boolean updateWindowFontIfNeeded)
   at System.Windows.Forms.Control.Scale(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.Control.ScaleChildControls(SizeF includedFactor, SizeF excludedFactor, Control requestingControl, Boolean updateWindowFontIfNeeded)
   at System.Windows.Forms.ContainerControl.Scale(SizeF includedFactor, SizeF excludedFactor, Control requestingControl)
   at System.Windows.Forms.ContainerControl.PerformAutoScale(Boolean includedBounds, Boolean excludedBounds)
   at System.Windows.Forms.ContainerControl.PerformNeededAutoScaleOnLayout()
   at System.Windows.Forms.ContainerControl.OnLayoutResuming(Boolean performLayout)
   at System.Windows.Forms.Control.ResumeLayout(Boolean performLayout)
   at TestForm.Main.InitializeComponent() in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\TestForm\Main.Designer.cs:line 611
   at TestForm.Main..ctor() in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\TestForm\Main.cs:line 20
   at TestForm.StartScreen.kbtnAboutBox_Click(Object sender, EventArgs e) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\TestForm\StartScreen.cs:line 27
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at Krypton.Toolkit.KryptonButton.OnClick(EventArgs e) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonButton.cs:line 636
   at Krypton.Toolkit.KryptonButton.OnButtonClick(Object sender, MouseEventArgs e) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonButton.cs:line 930
   at Krypton.Toolkit.ButtonController.OnClick(MouseEventArgs e) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\Controller\ButtonController.cs:line 892
   at Krypton.Toolkit.ButtonController.MouseUp(Control c, Point pt, MouseButtons button) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\Controller\ButtonController.cs:line 410
   at Krypton.Toolkit.ViewBase.MouseUp(Point pt, MouseButtons button) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\View Base\ViewBase.cs:line 562
   at Krypton.Toolkit.ViewBase.MouseUp(Point pt, MouseButtons button) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\View Base\ViewBase.cs:line 567
   at Krypton.Toolkit.ViewBase.MouseUp(Point pt, MouseButtons button) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\View Base\ViewBase.cs:line 567
   at Krypton.Toolkit.ViewBase.MouseUp(Point pt, MouseButtons button) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\View Base\ViewBase.cs:line 567
   at Krypton.Toolkit.ViewManager.MouseUp(MouseEventArgs e, Point rawPt) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\View Base\ViewManager.cs:line 514
   at Krypton.Toolkit.VisualControlBase.OnMouseUp(MouseEventArgs e) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\Controls Visuals\VisualControlBase.cs:line 937
   at Krypton.Toolkit.KryptonButton.OnMouseUp(MouseEventArgs e) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonButton.cs:line 845
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at Krypton.Toolkit.VisualControlBase.WndProc(Message& m) in D:\Temp.Source\Repos\Standard-Toolkit-alpha-2024-05-14\Source\Krypton Components\Krypton.Toolkit\Controls Visuals\VisualControlBase.cs:line 1149
   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.9181.0 built by: NET481REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
TestForm
    Assembly Version: 90.24.5.137
    Win32 Version: 90.24.05.137
    CodeBase: file:///D:/Temp.Source/Repos/Standard-Toolkit-alpha-2024-05-14/Source/Krypton%20Components/TestForm/bin/Debug/net48/TestForm.exe
----------------------------------------
Krypton.Toolkit
    Assembly Version: 90.24.5.137
    Win32 Version: 90.24.05.137
    CodeBase: file:///D:/Temp.Source/Repos/Standard-Toolkit-alpha-2024-05-14/Source/Krypton%20Components/TestForm/bin/Debug/net48/Krypton.Toolkit.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9181.0 built by: NET481REL1LAST_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
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9206.0 built by: NET481REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9032.0 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.9032.0 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.9200.0 built by: NET481REL1LAST_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.9032.0 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.9032.0 built by: NET481REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Design
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9032.0 built by: NET481REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Design/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
System.Drawing.Design
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.9032.0 built by: NET481REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing.Design/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.Design.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" />
</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.
@giduac giduac added the bug Something isn't working label May 14, 2024
@giduac
Copy link
Author

giduac commented May 14, 2024

@Wagnerp
Please, assign to Giduac.

TY!

@Wagnerp Wagnerp added this to the Version 90 milestone May 14, 2024
@Wagnerp Wagnerp added the in progress A fix for this issue is in the works. label May 14, 2024
@Wagnerp
Copy link
Contributor

Wagnerp commented May 14, 2024

@Wagnerp Please, assign to Giduac.

TY!

@giduac

Done! :)

@giduac
Copy link
Author

giduac commented May 14, 2024

@Wagnerp

A question about this and maybe you can help me short circuit this.

The error happens when the main form is shown and the Office 365 blue theme is active.
When for example the Office 365 Dark theme is active all is good.
When the font type and size is changed in StateCommon.Content in the designer the error is gone.

Could you please have a look if there are differences between the Blue and Dark theme which could lead to this?

@Wagnerp
Copy link
Contributor

Wagnerp commented May 14, 2024

@Wagnerp

A question about this and maybe you can help me short circuit this.

The error happens when the main form is shown and the Office 365 blue theme is active. When for example the Office 365 Dark theme is active all is good. When the font type and size is changed in StateCommon.Content in the designer the error is gone.

Could you please have a look if there are differences between the Blue and Dark theme which could lead to this?

Hi @giduac

The only differences I can think of are the colours. You could use a application called WinMerge to compare the differences.

@giduac
Copy link
Author

giduac commented May 14, 2024

@Wagnerp
The only differences I can think of are the colours. You could use a application called WinMerge to compare the differences.

if a font is selected/set here then the errror is gone. Remove the font and the error is back.

image

@giduac
Copy link
Author

giduac commented May 15, 2024

@Smurf-IV
Can you please spare a couple of minutes and have a look at the topic start and the findings so far to see if you can point us in right direction here.

@Smurf-IV
Copy link
Member

@giduac FYI: I have other things scheduled - I'll not be able to get to this until the 26th of May at the earliest.

@giduac
Copy link
Author

giduac commented May 15, 2024

@giduac FYI: I have other things scheduled - I'll not be able to get to this until the 26th of May at the earliest.

OK, NP.

I'll see how far I can get on this in the mean time.

@giduac
Copy link
Author

giduac commented May 18, 2024

@Smurf-IV & @Wagnerp
Narrowed down further. Topic start updated.

@Smurf-IV
Copy link
Member

@giduac are you in a position to solve this, Or do you want me to "have a go" at it still ?

@giduac
Copy link
Author

giduac commented May 28, 2024

Hi @Smurf-IV ,
I'd like you to have a look at it and see what you can make of it.
Not sure if I got all the info that's to be had.
This ain't cut and dried, and could well be an error within dotnet itself.

The topic start shows how far i got.
And main.cs in Testform still has this error.

Keep me posted on your findings and I'll see if I can be of assistance...

@Smurf-IV Smurf-IV assigned Smurf-IV and unassigned giduac May 28, 2024
@Smurf-IV Smurf-IV added regression Something was working in a previous release, but isn't working now. and removed in progress A fix for this issue is in the works. labels May 28, 2024
@giduac giduac changed the title [Bug]: TestForm app: KCombobox from main.cs causes a crash when theme is MS Office 365 Blue [Bug]: TestForm app: KCombobox from main.cs causes a crash May 28, 2024
@giduac
Copy link
Author

giduac commented May 28, 2024

@Smurf-IV
FYI: Corrected the title and added to the topic start:
- Added: as stated earlier, it is not related to a specific theme.

Smurf-IV added a commit that referenced this issue May 28, 2024
…t of sync

- Fix Default of `Near` foe edit controls in deisgner view
- Some Resharper Warnings
- Some intellisense warnings
- Fix a few TestForm code issues

#1462
@Smurf-IV
Copy link
Member

Incoming PR:
image

@giduac
Copy link
Author

giduac commented May 28, 2024

@Smurf-IV
Tested this on alpha and the error is gone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Something was working in a previous release, but isn't working now.
Projects
None yet
Development

No branches or pull requests

3 participants