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

[Other Issues]: Cleanup warnings #1418

Closed
giduac opened this issue Apr 22, 2024 · 24 comments
Closed

[Other Issues]: Cleanup warnings #1418

giduac opened this issue Apr 22, 2024 · 24 comments
Labels
completed This issue has been completed. discussion Discussion thread. other All other issues.
Milestone

Comments

@giduac
Copy link

giduac commented Apr 22, 2024

Keeping track of files handled in the topic start and possible discussion about this can be done in this thread.

1418-cleanup-warnings-0043 | PR 1499 | Warnings: 0 | Remove disabled null checks
1418-cleanup-warnings-0042 | PR 1487 | Warnings 4 | Removes the publickey warnings CS1700
1418-cleanup-warnings-0041 | PR 1486 | Warnings 32 | Cleanup remaining warnings.
1418-cleanup-warnings-0031 | PR 1474 | Warnings 81 Revisits previously disabled throw statements.
1418-cleanup-warnings-0040 | PR 1472 | Warnings 402 | Check on CommonHelper
1418-cleanup-warnings-0030 | PR 1471 | Warnings 420 | Several warnings removed
1418-cleanup-warnings-0027 | PR 1459 | Warnings 429 | Toolkit third part
1418-cleanup-warnings-0026 | PR 1458 | Warnings 3014 | Toolkit second part
1418-cleanup-warnings-0025 | PR 1457 | Warnings 12922 | Toolkit first part
1418-cleanup-warnings-0020 | PR 1453 | Warnings 17614 | Workspace complete
1418-cleanup-warnings-0012 | PR 1451 | Warnings 19721 | Navigator second part (count is off, build without merging alpha)
1418-cleanup-warnings-0011 | PR 1446 | Warnings 19273 | Navigator first part
1418-cleanup-warnings-0010 | PR 1445 | Warnings 20224 | Docking module
1418-cleanup-warnings-0007 | PR 1444 | Warnings before: 20258 | Warnings after: 20061
1418-cleanup-warnings-0006 | PR 1443 | Warnings before: 26097 | Warnings after: 20258
1418-cleanup-warnings-0005 | PR 1440 | Warnings before: 29131 | Warnings after: 26097
1418-cleanup-warnings-0004 | PR 1438 | Warnings before: 29869 | Warnings after: 29131
1418-cleanup-warnings-0003 | PR 1437 | Warnings before: 30125 | Warnings after: 29869
1418-cleanup-warnings-0002 | PR 1429 | Warnings before: 30386 | Warnings after: 30164
1418-cleanup-warnings-0001 | PR 1421 | Warnings before: 30666 | Warnings after :30386
@giduac giduac added discussion Discussion thread. other All other issues. labels Apr 22, 2024
@giduac
Copy link
Author

giduac commented Apr 23, 2024

Unresolved / needs more attention:

** --------------------------------------------------------------- **
** PR 1471: #1471 **
** --------------------------------------------------------------- **
Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonCommandLinkButton.cs

  • Attribute: 'ClassInterfaceType.AutoDispatch`
  • Warning CS0618 'ClassInterfaceType.AutoDispatch' is obsolete: 'Support for IDispatch may be unavailable in future releases.' Krypton.Toolkit 2022 (net6.0-windows)
  • Line 20: [ClassInterface(ClassInterfaceType.AutoDispatch)]

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewButtonColumn.cs

  • Property: DefaultCellStyle
  • Warning: CS8764 Nullability of return type doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewComboBoxEditingControl.cs

  • Property: EditingControlFormattedValue
  • Warning: CS8767 Nullability of reference types in type of parameter 'value' of 'void KryptonDataGridViewComboBoxEditingControl.EditingControlFormattedValue.set' doesn't match implicitly
    implemented member 'void IDataGridViewEditingControl.EditingControlFormattedValue.set' (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewCustomEditingControl.cs

  • Property: 'EditingControlFormattedValue'
  • Warning: CS8767 Nullability of reference types in type of parameter 'value' of 'void KryptonDataGridViewCustomEditingControl.EditingControlFormattedValue.set' doesn't match implicitly implemented member 'void IDataGridViewEditingControl.EditingControlFormattedValue.set' (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewDateTimePickerEditingControl.cs

  • Property: KryptonDataGridViewDateTimePickerEditingControl.EditingControlFormattedValue
  • Warning: CS8767 Nullability of reference types in type of parameter 'value' of 'void KryptonDataGridViewDateTimePickerEditingControl.EditingControlFormattedValue.set' doesn't match implicitly implemented member 'void IDataGridViewEditingControl.EditingControlFormattedValue.set' (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewDomainUpDownEditingControl.cs

  • Property: EditingControlFormattedValue
  • Warning: CS8767 Nullability of reference types in type of parameter 'value' of 'void KryptonDataGridViewDomainUpDownEditingControl.EditingControlFormattedValue.set' doesn't match implicitly implemented member 'void IDataGridViewEditingControl.EditingControlFormattedValue.set' (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewMaskedTextBoxEditingControl.cs

  • Property: EditingControlFormattedValue
  • Warning: CS8767 Nullability of reference types in type of parameter 'value' of 'void KryptonDataGridViewMaskedTextBoxEditingControl.EditingControlFormattedValue.set' doesn't match implicitly implemented member 'void IDataGridViewEditingControl.EditingControlFormattedValue.set' (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewNumericUpDownEditingControl.cs

  • Property: EditingControlFormattedValue
  • Warning: CS8767 Nullability of reference types in type of parameter 'value' of 'void KryptonDataGridViewNumericUpDownEditingControl.EditingControlFormattedValue.set' doesn't match implicitly implemented member 'void IDataGridViewEditingControl.EditingControlFormattedValue.set' (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewTextBoxEditingControl.cs

  • Property: EditingControlFormattedValue
  • Warning: CS8767 Nullability of reference types in type of parameter 'value' of 'void KryptonDataGridViewTextBoxEditingControl.EditingControlFormattedValue.set' doesn't match implicitly implemented member 'void IDataGridViewEditingControl.EditingControlFormattedValue.set' (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonDataGridViewTextBoxColumn.cs

  • Property: DefaultCellStyle
  • Warning: CS8765 Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonListBox.cs

  • Property: Font
  • Warning: CS8765 Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonListBox.cs

  • Property: Text
  • Warning: CS8765 Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonProgressBar.cs

  • Property: 'BackgroundImage'
  • Warning: CS8765 Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonProgressBar.cs

  • Property: 'ContextMenuStrip'
  • Warning: CS8765 Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonProgressBar.cs

  • Property: 'Font'
  • Warning: CS8765 Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\Controls Toolkit\KryptonProgressBarToolStripItem.cs

  • Property: Text
  • Warning: CS8765 Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
  • Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\General\KryptonAboutBoxUtilities.cs

  • Line: 59
  • Statement: if (TimeZone.IsDaylightSavingTime(dateTime, TimeZone.CurrentTimeZone.GetDaylightChanges(dateTime.Year)))
  • Warning: CS0618 'TimeZone' is obsolete: 'System.TimeZone has been deprecated. Investigate the use of System.TimeZoneInfo instead.' Krypton.Toolkit 2022 (net6.0-windows),
  • Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\General\KryptonAboutBoxUtilities.cs

  • Line: 233
  • Statement: Populate(assemblyData, $@"{KryptonManager.Strings.AboutBoxStrings.LoadedFromGlobalAssemblyCache}", $@"{assembly.GlobalAssemblyCache}");
  • Warning SYSLIB0005 'Assembly.GlobalAssemblyCache' is obsolete: 'The Global Assembly Cache is not supported.'
  • Krypton.Toolkit 2022 (net6.0-windows), Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

Resolved:
Krypton.Toolkit\General\KryptonAboutBoxUtilities.cs

  • Line: 177
  • Statement: nvc.Add("CodeBase", assembly.EscapedCodeBase.Replace("file:///", ""));
  • Warning SYSLIB0012 'Assembly.EscapedCodeBase' is obsolete: 'Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location.'
  • Krypton.Toolkit 2022 (net6.0-windows), Krypton.Toolkit 2022 (net8.0-windows), Krypton.Toolkit 2022 (net9.0-windows)

** --------------------------------------------------------------- **
** END PR 1471: #1471 **
** --------------------------------------------------------------- **

@Wagnerp
Copy link
Contributor

Wagnerp commented Apr 24, 2024

Hi @Wagnerp Since some strings are needed with the throw exceptions it might be better to put those in central location and reuse them. Where could those be stored and how to go about it ?

Hi @giduac

You can use GlobalStaticValues.cs

@giduac
Copy link
Author

giduac commented Apr 24, 2024

Krypton.Toolkit\General\CommonHelper.cs

  • Several methods in this module need a review as they should take null as an input and return a default value.
    Example method that has been changed like so:
        public static Point StringToPoint(string? s) => s is not null
            ? (Point)_pc.ConvertFromInvariantString(s)!
            : new Point(0);

But then the call (Point)_pc.ConvertFromInvariantString(s)! needs a checkup too .
Or the input needs to be checked upfront to be convertible.

[Krypton.Docking/Elements Impl/KryptonDockingFloatingWindow.cs

  • Line 216 & 217
  • Part of the CommonHelper above

Redirect and Controllers that had their null checks disabled

  • Need a closer look to see what is needed to straighten-out the mix of non-nullables, nullabbles, [DisallowNull]''s and null checks or the lack thereof.

Inventory

public static bool ValidContextMenuStrip(ContextMenuStrip? cms) =>

  • Line 400

@Wagnerp
Copy link
Contributor

Wagnerp commented Apr 24, 2024

Hi @Wagnerp,

Can these be methods be added there as well?

public static string VariableCannotBeNull( string variableName ) => $"Variable {variableName} cannot be null.";
public static string PropertyCannotBeNull( string propertyName ) => $"Property {propertyName} cannot be null.";

Maybe in a separate region

Hi @giduac

Yes they can, since they're static

@giduac
Copy link
Author

giduac commented Apr 24, 2024

@Wagnerp
Shall we put them in a separate section or where else?

@Wagnerp
Copy link
Contributor

Wagnerp commented Apr 24, 2024

@Wagnerp Shall we put them in a separate section or where else?

@giduac

You can define a new region, or create a new GlobalStaticMethods class.

@giduac
Copy link
Author

giduac commented Apr 24, 2024

@Wagnerp
Then we'll add a region "Methods".
TY

@giduac
Copy link
Author

giduac commented May 7, 2024

@Wagnerp

Could you please have a look at this file: Krypton.Toolkit\General\WinFormsDefinitions.cs
Line 9: there's a warning about: "SystemIconsCustom.GetStockIcon(StockIconId, StockIconOptions)
And again on 484.

Do you have an idea which method in the xml that should be?

@Wagnerp
Copy link
Contributor

Wagnerp commented May 7, 2024

@Wagnerp

Could you please have a look at this file: Krypton.Toolkit\General\WinFormsDefinitions.cs Line 9: there's a warning about: "SystemIconsCustom.GetStockIcon(StockIconId, StockIconOptions) And again on 484.

Do you have an idea which method in the xml that should be?

@giduac

That can be commented out, it's an attempt at backporting StockIcon features

@Wagnerp
Copy link
Contributor

Wagnerp commented May 19, 2024

Hi @giduac

There seems to be a issue in PaletteTripleJustImage as shown below?

Bug

@giduac
Copy link
Author

giduac commented May 19, 2024

@Wagnerp
That's been fixed in alpha.

This was referenced May 20, 2024
@giduac
Copy link
Author

giduac commented May 21, 2024

@Smurf-IV @Wagnerp

I posted this earlier but received no response.
Before I turn this into a ticket can you have a look at this code as it imo contains a bug.

file: TK/Ribbon/Controllers/QATExtraButtonController.cs
method: public void KeyTipSelect(KryptonRibbon ribbon)
Statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null));
The code in method GetQATKeyTips() does not perform a null check on it's input parameter. Actually null cause a crash.

And in KT/Ribbon/Controls Ribbon/KryptonRibbon.cs at line 2360 a similar call
Did a search for GetQATKeyTips() in the entire solution and that came up with these 2.

Shall we handle the null input or change the null param to a valid reference and what should that be ?

@Wagnerp
Copy link
Contributor

Wagnerp commented May 21, 2024

@Smurf-IV @Wagnerp

I posted this earlier but received no response. Before I turn this into a ticket can you have a look at this code as it imo contains a bug.

file: TK/Ribbon/Controllers/QATExtraButtonController.cs method: public void KeyTipSelect(KryptonRibbon ribbon) Statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null)); The code in method GetQATKeyTips() does not perform a null check on it's input parameter. Actually null cause a crash.

And in KT/Ribbon/Controls Ribbon/KryptonRibbon.cs at line 2360 a similar call Did a search for GetQATKeyTips() in the entire solution and that came up with these 2.

Shall we handle the null input or change the null param to a valid reference and what should that be ?

Hi @giduac

I've just changed it to public void KeyTipSelect(KryptonRibbon? ribbon)

@giduac
Copy link
Author

giduac commented May 21, 2024

Hi @Wagnerp ,

Could you please have a look at
KryptonThemeComboBoxDesigner.cs
and
KryptonThemeComboBox.cs

There are several warnings in the build log (from alpha) there but I'm not fully sure if those fields mentioned can be removed or moved to another location.

If you want to correct it that's ok of course or tell met what to do and I'll fix it along with the others?

@giduac
Copy link
Author

giduac commented May 21, 2024

@Smurf-IV @Wagnerp
I posted this earlier but received no response. Before I turn this into a ticket can you have a look at this code as it imo contains a bug.
file: TK/Ribbon/Controllers/QATExtraButtonController.cs method: public void KeyTipSelect(KryptonRibbon ribbon) Statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null)); The code in method GetQATKeyTips() does not perform a null check on it's input parameter. Actually null cause a crash.
And in KT/Ribbon/Controls Ribbon/KryptonRibbon.cs at line 2360 a similar call Did a search for GetQATKeyTips() in the entire solution and that came up with these 2.
Shall we handle the null input or change the null param to a valid reference and what should that be ?

Hi @giduac

I've just changed it to public void KeyTipSelect(KryptonRibbon? ribbon)
@Wagnerp
I'm sorry but that's not the solution.

The KeyTipSelect(KryptonRibbon? ribbon) method does not process a null reference. It actually will crash on null.
This part of the Ribbon does not seem to get called since there are no bug tickets about it.

So there are two options, imo:

  1. Make sure the callers pass a valid reference to KeyTipSelect()?
  2. Have KeyTipSelect() accept a null reference and handle it?

@Wagnerp
Copy link
Contributor

Wagnerp commented May 21, 2024

@Smurf-IV @Wagnerp
I posted this earlier but received no response. Before I turn this into a ticket can you have a look at this code as it imo contains a bug.
file: TK/Ribbon/Controllers/QATExtraButtonController.cs method: public void KeyTipSelect(KryptonRibbon ribbon) Statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null)); The code in method GetQATKeyTips() does not perform a null check on it's input parameter. Actually null cause a crash.
And in KT/Ribbon/Controls Ribbon/KryptonRibbon.cs at line 2360 a similar call Did a search for GetQATKeyTips() in the entire solution and that came up with these 2.
Shall we handle the null input or change the null param to a valid reference and what should that be ?

Hi @giduac
I've just changed it to public void KeyTipSelect(KryptonRibbon? ribbon)
@Wagnerp
I'm sorry but that's not the solution.

The KeyTipSelect(KryptonRibbon? ribbon) method does not process a null reference. It actually will crash on null. This part of the Ribbon does not seem to get called since there are no bug tickets about it.

So there are two options, imo:

  1. Make sure the callers pass a valid reference to KeyTipSelect()?
  2. Have KeyTipSelect() accept a null reference and handle it?

Hi @giduac

Had another look, that parameter can be removed, since it's not used anywhere in the method.

@Wagnerp
Copy link
Contributor

Wagnerp commented May 21, 2024

Hi @Wagnerp ,

Could you please have a look at KryptonThemeComboBoxDesigner.cs and KryptonThemeComboBox.cs

There are several warnings in the build log (from alpha) there but I'm not fully sure if those fields mentioned can be removed or moved to another location.

If you want to correct it that's ok of course or tell met what to do and I'll fix it along with the others?

Hi @giduac

Does it say which fields are unused?

@giduac
Copy link
Author

giduac commented May 21, 2024

@Wagnerp

@Smurf-IV @Wagnerp
I posted this earlier but received no response. Before I turn this into a ticket can you have a look at this code as it imo contains a bug.
file: TK/Ribbon/Controllers/QATExtraButtonController.cs method: public void KeyTipSelect(KryptonRibbon ribbon) Statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null)); The code in method GetQATKeyTips() does not perform a null check on it's input parameter. Actually null cause a crash.
And in KT/Ribbon/Controls Ribbon/KryptonRibbon.cs at line 2360 a similar call Did a search for GetQATKeyTips() in the entire solution and that came up with these 2.
Shall we handle the null input or change the null param to a valid reference and what should that be ?

Hi @giduac
I've just changed it to public void KeyTipSelect(KryptonRibbon? ribbon)
@Wagnerp
I'm sorry but that's not the solution.

The KeyTipSelect(KryptonRibbon? ribbon) method does not process a null reference. It actually will crash on null. This part of the Ribbon does not seem to get called since there are no bug tickets about it.
So there are two options, imo:

  1. Make sure the callers pass a valid reference to KeyTipSelect()?
  2. Have KeyTipSelect() accept a null reference and handle it?

Hi @giduac

Had another look, that parameter can be removed, since it's not used anywhere in the method.

@Wagnerp
Let me explain it again (sorry for being overly clear), hope that works better:

in file:
TK/Ribbon/Controllers/QATExtraButtonController.cs

on line 152 contains method:
public void KeyTipSelect(KryptonRibbon ribbon)

which executes statement:
keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null));

in file:
Krypton.Ribbon\View Layout\ViewLayoutRibbonQATContents.cs

on line 112 the method is located that is called.
public KeyTipInfo[] GetQATKeyTips(KryptonForm ownerForm)

That is the method where the null param goes in.
And that method does not handle null for the ownerForm param.

Back to the two possible choices:

  1. Make sure the callers pass a valid reference to GetQATKeyTips()?
  2. Have GetQATKeyTips() accept a null reference and handle it?

@giduac
Copy link
Author

giduac commented May 21, 2024

Hi @Wagnerp ,
Could you please have a look at KryptonThemeComboBoxDesigner.cs and KryptonThemeComboBox.cs
There are several warnings in the build log (from alpha) there but I'm not fully sure if those fields mentioned can be removed or moved to another location.
If you want to correct it that's ok of course or tell met what to do and I'll fix it along with the others?

Hi @giduac

Does it say which fields are unused?

@Wagnerp
It does :)

Krypton.Toolkit\Controls Toolkit\KryptonThemeComboBox.cs(246,13): warning CS8765: Nullability of type of parameter 'value' doesn't match overridden member (possibly because of nullability attributes).
Krypton.Toolkit\Designers\Designers\KryptonThemeComboBoxDesigner.cs(16,22): warning CS0169: The field 'KryptonThemeComboBoxDesigner._lastHitTest' is never used
Krypton.Toolkit\Designers\Designers\KryptonThemeComboBoxDesigner.cs(20,31): warning CS0169: The field 'KryptonThemeComboBoxDesigner._designerHost' is never used
Krypton.Toolkit\Designers\Designers\KryptonThemeComboBoxDesigner.cs(22,35): warning CS0169: The field 'KryptonThemeComboBoxDesigner._selectionService' is never used
Krypton.Toolkit\Controls Toolkit\KryptonThemeComboBox.cs(109,32): info CS1591: Missing XML comment for publicly visible type or member 'KryptonThemeComboBox.Manager'
Krypton.Toolkit\Controls Toolkit\KryptonThemeComboBox.cs(300,24): info CS1591: Missing XML comment for publicly visible type or member 'KryptonThemeComboBox.SelectedIndex'

@Wagnerp
Copy link
Contributor

Wagnerp commented May 21, 2024

@Wagnerp

@Smurf-IV @Wagnerp
I posted this earlier but received no response. Before I turn this into a ticket can you have a look at this code as it imo contains a bug.
file: TK/Ribbon/Controllers/QATExtraButtonController.cs method: public void KeyTipSelect(KryptonRibbon ribbon) Statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null)); The code in method GetQATKeyTips() does not perform a null check on it's input parameter. Actually null cause a crash.
And in KT/Ribbon/Controls Ribbon/KryptonRibbon.cs at line 2360 a similar call Did a search for GetQATKeyTips() in the entire solution and that came up with these 2.
Shall we handle the null input or change the null param to a valid reference and what should that be ?

Hi @giduac
I've just changed it to public void KeyTipSelect(KryptonRibbon? ribbon)
@Wagnerp
I'm sorry but that's not the solution.

The KeyTipSelect(KryptonRibbon? ribbon) method does not process a null reference. It actually will crash on null. This part of the Ribbon does not seem to get called since there are no bug tickets about it.
So there are two options, imo:

  1. Make sure the callers pass a valid reference to KeyTipSelect()?
  2. Have KeyTipSelect() accept a null reference and handle it?

Hi @giduac
Had another look, that parameter can be removed, since it's not used anywhere in the method.

@Wagnerp Let me explain it again (sorry for being overly clear), hope that works better:

in file: TK/Ribbon/Controllers/QATExtraButtonController.cs

on line 152 contains method: public void KeyTipSelect(KryptonRibbon ribbon)

which executes statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null));

in file: Krypton.Ribbon\View Layout\ViewLayoutRibbonQATContents.cs

on line 112 the method is located that is called. public KeyTipInfo[] GetQATKeyTips(KryptonForm ownerForm)

That is the method where the null param goes in. And that method does not handle null for the ownerForm param.

Back to the two possible choices:

  1. Make sure the callers pass a valid reference to GetQATKeyTips()?
  2. Have GetQATKeyTips() accept a null reference and handle it?

Hi @giduac

Possibly have it pass a valid reference, as changing it in IRibbonKeyTipTarget would cause chaos.

@giduac
Copy link
Author

giduac commented May 21, 2024

@Wagnerp

@Smurf-IV @Wagnerp
I posted this earlier but received no response. Before I turn this into a ticket can you have a look at this code as it imo contains a bug.
file: TK/Ribbon/Controllers/QATExtraButtonController.cs method: public void KeyTipSelect(KryptonRibbon ribbon) Statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null)); The code in method GetQATKeyTips() does not perform a null check on it's input parameter. Actually null cause a crash.
And in KT/Ribbon/Controls Ribbon/KryptonRibbon.cs at line 2360 a similar call Did a search for GetQATKeyTips() in the entire solution and that came up with these 2.
Shall we handle the null input or change the null param to a valid reference and what should that be ?

Hi @giduac
I've just changed it to public void KeyTipSelect(KryptonRibbon? ribbon)
@Wagnerp
I'm sorry but that's not the solution.

The KeyTipSelect(KryptonRibbon? ribbon) method does not process a null reference. It actually will crash on null. This part of the Ribbon does not seem to get called since there are no bug tickets about it.
So there are two options, imo:

  1. Make sure the callers pass a valid reference to KeyTipSelect()?
  2. Have KeyTipSelect() accept a null reference and handle it?

Hi @giduac
Had another look, that parameter can be removed, since it's not used anywhere in the method.

@Wagnerp Let me explain it again (sorry for being overly clear), hope that works better:
in file: TK/Ribbon/Controllers/QATExtraButtonController.cs
on line 152 contains method: public void KeyTipSelect(KryptonRibbon ribbon)
which executes statement: keyTipList.AddRange(popupOverflow.ViewQATContents.GetQATKeyTips(null));
in file: Krypton.Ribbon\View Layout\ViewLayoutRibbonQATContents.cs
on line 112 the method is located that is called. public KeyTipInfo[] GetQATKeyTips(KryptonForm ownerForm)
That is the method where the null param goes in. And that method does not handle null for the ownerForm param.
Back to the two possible choices:

  1. Make sure the callers pass a valid reference to GetQATKeyTips()?
  2. Have GetQATKeyTips() accept a null reference and handle it?

Hi @giduac

Possibly have it pass a valid reference, as changing it in IRibbonKeyTipTarget would cause chaos.

And thats the question what reference from the caller would that be...

@Wagnerp
Copy link
Contributor

Wagnerp commented May 21, 2024

KryptonThemeComboBoxDesigner

Hi @giduac

I've now fixed these, quite trivial :)

@giduac
Copy link
Author

giduac commented May 21, 2024

KryptonThemeComboBoxDesigner

Hi @giduac

I've now fixed these, quite trivial :)

Can you put that in a PR so it gets merged in the morning..?

@Wagnerp
Copy link
Contributor

Wagnerp commented May 21, 2024

KryptonThemeComboBoxDesigner

Hi @giduac
I've now fixed these, quite trivial :)

Can you put that in a PR so it gets merged in the morning..?

Will do, log is at 357. It has gone down since the removal of .NET 7.

@Smurf-IV Smurf-IV added the in progress A fix for this issue is in the works. label May 26, 2024
@Smurf-IV Smurf-IV added this to the Version 90 milestone May 26, 2024
This was referenced May 26, 2024
@Smurf-IV Smurf-IV added completed This issue has been completed. and removed in progress A fix for this issue is in the works. labels May 28, 2024
@giduac giduac changed the title [Other Issues]: Cleanup warnings KT/Ribbon/Controller [Other Issues]: Cleanup warnings May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This issue has been completed. discussion Discussion thread. other All other issues.
Projects
None yet
Development

No branches or pull requests

3 participants