HandyOrg / HandyOrg/HandyControl

'The type initializer for 'HandyControl.Controls.Window' threw an exception.'

Open
#442 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

:bug: bug :thinking: pending discussion
Dominant language
C#
Stars
7.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

The exception occurs at Messagebox.Show/Ask/Error etc calls.
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

To Reproduce
Steps to reproduce the behavior:
This happens randomly and I couldn't find the exact way to reproduce.

Environment (please complete the following information):

  • .net: [.net core 3.1
  • IDE [e.g. vs2019]
  • Version [2.5.3.2]
Stack Trace-
at HandyControl.Controls.Window..ctor()
   at HandyControl.Controls.MessageBox..ctor()
   at HandyControl.Controls.MessageBox.CreateMessageBox(Window owner, String messageBoxText, String caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, String cancelContent, String confirmContent, String yesContent, String noContent)
   at HandyControl.Controls.MessageBox.<>c__DisplayClass44_0.<Ask>b__0()
   at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
   at System.Windows.Threading.Dispatcher.Invoke(Action callback)
   at HandyControl.Controls.MessageBox.Ask(String messageBoxText, String caption)
   at demo.ViewModels.MainWindowViewModel.DeleteIconsMethod() in C:\Users\myusername\source\repos\demo\demo\ViewModels\MainWindowViewModel.cs:line 441
   at Prism.Commands.DelegateCommand.Execute()
   at Prism.Commands.DelegateCommand.Execute(Object parameter)
   at Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the HandyControl.Controls.Window constructor and follow the stack trace through MessageBox.CreateMessageBox and MessageBox.Ask, using the supplied ArgumentOutOfRangeException as the entry point. Investigate why the randomly triggered MessageBox calls access an invalid collection index; done means the reported calls no longer throw this initializer exception, with reproducible verification if a test path can be established.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.