Skip to content

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

Description

@DineshSolanki

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions