Krypton-Suite / Standard-Toolkit

An update to Component factory's krypton toolkit to support .NET Framework 4.6.2 - 4.8.1 to .NET 6 - 8
BSD 3-Clause "New" or "Revised" License
400 stars 61 forks source link

[Bug]: VisualMessageBoxForm throws exception when used with custom theme #1552

Closed lukas2-werner closed 2 months ago

lukas2-werner commented 4 months ago

Describe the bug The following message pops up if I open a KryptonMessageBox while a custom theme is loaded: image looking at the stack trace: image It seems it is this line that is causing the bug: https://github.com/Krypton-Suite/Standard-Toolkit/blob/cfc99500bbcd07061dc750a79651180540d72fbc/Source/Krypton%20Components/Krypton.Toolkit/Controls%20Visuals/VisualMessageBoxForm.Designer.cs#L205

Desktop (please complete the following information):

giduac commented 4 months ago

Hi @lukas2-werner,

Can you please state which custom theme you are using? Can you provide a sample program that reproduces the error please?

lukas2-werner commented 4 months ago

I use this theme https://github.com/Krypton-Suite/Theme-Palettes/blob/alpha/Palettes/Other/Asphalt_v19.xml Unfortunately I cannot provide the program. The bug was introduced in this commit and as far as I can tell the InputControlStyle should not be set to PanelClient but left in its default state. If I remove that line everything works.

giduac commented 4 months ago

Hi @lukas2-werner

I understand that you cannot provide the actual program and we don't need that. But can you please provide new small sample program that reproduces the error clearly.

In that way we don't have guess or try all kind of combinations to reproduce the error.

TY.

lukas2-werner commented 4 months ago

I just tried it with a random example 'Test MessageBox Clipping 2022' from Standard-Toolkit-Demos. Change to latest nightly. Change this line to:

string themePath = @"......Asphalt_v19.xml";

KryptonCustomPaletteBase palette = new();
using (Stream stream = new FileStream(themePath, FileMode.Open))
{
    palette.Import(stream);
}
kryptonManager.GlobalCustomPalette = palette;

Start the example and switch to custom theme. Pressing a button to open the MessageBox produces the error

PWagner1 commented 4 months ago

This is triggered (possibly) by a missing case in a switch statement. The debug tools are really helping with locating these types of bugs.

giduac commented 4 months ago

@lukas2-werner Ty.

@Wagnerp, That sounds a like a case for you ...

PWagner1 commented 4 months ago

Hi @giduac

Building on my last response, the bug is in GetPalettePanel in KryptonCustomPaletteBase

@lukas2-werner

Can you please provide a sample that triggers this bug all the time?

lukas2-werner commented 3 months ago

I just tried it with a random example 'Test MessageBox Clipping 2022' from Standard-Toolkit-Demos. Change to latest nightly. Change this line to:

string themePath = @"......Asphalt_v19.xml";

KryptonCustomPaletteBase palette = new();
using (Stream stream = new FileStream(themePath, FileMode.Open))
{
    palette.Import(stream);
}
kryptonManager.GlobalCustomPalette = palette;

Start the example and switch to custom theme. Pressing a button to open the MessageBox produces the error

Hi @Wagnerp I can reproduce the error with the steps above. Let me know if you need further info.

PWagner1 commented 3 months ago

I just tried it with a random example 'Test MessageBox Clipping 2022' from Standard-Toolkit-Demos. Change to latest nightly. Change this line to:

string themePath = @"......Asphalt_v19.xml";

KryptonCustomPaletteBase palette = new();
using (Stream stream = new FileStream(themePath, FileMode.Open))
{
    palette.Import(stream);
}
kryptonManager.GlobalCustomPalette = palette;

Start the example and switch to custom theme. Pressing a button to open the MessageBox produces the error

Hi @Wagnerp I can reproduce the error with the steps above. Let me know if you need further info.

Hi @lukas2-werner

What happens if you directly feed the path into the Import() function, i.e. Import("<#PATH-TO-FILE#>\Asphalt_v19.xml")?

lukas2-werner commented 3 months ago

The same thing happens.

PWagner1 commented 3 months ago

@Smurf-IV Is there a way to do a recursive upgrade of palettes, as many of them are still on v19 & the current version is 21?

cc. @giduac

giduac commented 3 months ago

@Wagnerp Which files is it about? What needs changing?

PWagner1 commented 3 months ago

@Wagnerp Which files is it about? What needs changing?

@giduac

The custom palette XML files need updating to use the latest schema. It can be done individually using https://github.com/Krypton-Suite/Theme-Palettes/tree/master/Applications/Source/Palette%20Upgrade%20Tool, but I wonder if it can be extended to accept a folder as a input/output?

Smurf-IV commented 3 months ago

@Wagnerp Which files is it about? What needs changing?

@giduac

The custom palette XML files need updating to use the latest schema. It can be done individually using https://github.com/Krypton-Suite/Theme-Palettes/tree/master/Applications/Source/Palette%20Upgrade%20Tool, but I wonder if it can be extended to accept a folder as a input/output?

Create an item in the Themes repo backlog please?

giduac commented 3 months ago

@Wagnerp Which files is it about? What needs changing?

@giduac

The custom palette XML files need updating to use the latest schema. It can be done individually using https://github.com/Krypton-Suite/Theme-Palettes/tree/master/Applications/Source/Palette%20Upgrade%20Tool, but I wonder if it can be extended to accept a folder as a input/output?

@Wagnerp Is the version discrepancy the cause of this bug?

PWagner1 commented 3 months ago

@Wagnerp Which files is it about? What needs changing?

@giduac The custom palette XML files need updating to use the latest schema. It can be done individually using https://github.com/Krypton-Suite/Theme-Palettes/tree/master/Applications/Source/Palette%20Upgrade%20Tool, but I wonder if it can be extended to accept a folder as a input/output?

@Wagnerp Is the version discrepancy the cause of this bug?

@giduac

Need to test, but the toolkit should prompt the user to upgrade the palette XML if it's incompatible...

PWagner1 commented 3 months ago

@Smurf-IV & @giduac

Are you having issues doing anything in the demos?

image

Smurf-IV commented 3 months ago

@Smurf-IV & @giduac

Are you having issues doing anything in the demos?

Yes; that has been happening today, was not sure if it was a Weirdness with 17.11 p4 or not, because when you go and open the file, the warnings go away?!?!?!

Smurf-IV commented 3 months ago

Does not appear in VS 17.10.4 (It just complains about the use of .Net 9 SDK!)

PWagner1 commented 3 months ago

Hi @lukas2-werner

Looks like a palette version incompatibility issue. Have you tried upgrading it?

cc. @Smurf-IV & @giduac

lukas2-werner commented 3 months ago

Yes, I used the Palette Upgrade Tool but the result is the same. I tested different alpha releases and found that this commit https://github.com/Krypton-Suite/Standard-Toolkit/commit/3d25e5ae049e15b897340ae5512772e14e30955c#diff-909c8db448444eaef31624917ade63e1ebd73f8c72998db89db7851e48443d6c is where it broke. Before that everything works.

giduac commented 2 months ago

Hi @lukas2-werner, cc: @Wagnerp

Keep an eye on discord for the notification when the next nightly will be released. Please let us know your findings.

lukas2-werner commented 1 month ago

I tested the 90.24.8.232-alpha and it works. Thank you for the fix!