microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.28k stars 6.55k forks source link

Destination array was not long enough. #19707

Closed BlairLeduc closed 1 year ago

BlairLeduc commented 2 years ago

Microsoft PowerToys version

"0.60.1.0"

Running as admin

Area(s) with issue?

General

Steps to reproduce

Random or awake from sleep?

[2022-08-01 22:03:42.4234] [FATAL]

Exception

System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
   Source: System.Private.CoreLib
   TargetAssembly: System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
   TargetModule: System.Private.CoreLib.dll
   TargetSite: Void Copy(System.Array, Int32, System.Array, Int32, Int32, Boolean)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at System.Collections.Generic.List`1.System.Collections.ICollection.CopyTo(Array array, Int32 arrayIndex)
   at System.Collections.ArrayList.InsertRange(Int32 index, ICollection c)
   at System.Windows.Data.ListCollectionView.<RefreshOverride>b__1_0()
   at MS.Internal.Data.SynchronizationInfo.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess)
   at System.Windows.Data.BindingOperations.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess)
   at System.Windows.Data.ListCollectionView.RefreshOverride()
   at System.Windows.Data.CollectionView.RefreshInternal()
   at System.Windows.Data.CollectionView.PostChange(NotifyCollectionChangedEventArgs args)
   at PowerLauncher.ViewModel.MainViewModel.<>c__DisplayClass123_0.<UpdateResultsListViewAfterQuery>b__0()
   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)

Environment

Assemblies - PowerToys.PowerLauncher

✔️ Expected Behavior

No error

❌ Actual Behavior

Version: 0.60.1.0 OS Version: Microsoft Windows NT 10.0.19044.0 IntPtr Length: 8 x64: True Date: 01/08/2022 22:03:42 Exception: System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray') at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length) at System.Collections.Generic.List`1.System.Collections.ICollection.CopyTo(Array array, Int32 arrayIndex) at System.Collections.ArrayList.InsertRange(Int32 index, ICollection c) at System.Windows.Data.ListCollectionView.b1_0() at MS.Internal.Data.SynchronizationInfo.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess) at System.Windows.Data.BindingOperations.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess) at System.Windows.Data.ListCollectionView.RefreshOverride() at System.Windows.Data.CollectionView.RefreshInternal() at System.Windows.Data.CollectionView.PostChange(NotifyCollectionChangedEventArgs args) at PowerLauncher.ViewModel.MainViewModel.<>c__DisplayClass123_0.b0() 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)

Other Software

No response

BlairLeduc commented 2 years ago

Observed in v0.61.0.

crutkas commented 2 years ago

we have seen this in the past as well. https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+Destination+array+is%3Aclosed

jaimecbernardo commented 1 year ago

If it's like #21308, it seems to be hard to repro.

BlairLeduc commented 1 year ago

This issue still occurs in 0.64.1.0

BlairLeduc commented 1 year ago

If it's like #21308, it seems to be hard to repro.

I wonder if #21308 was just a coincidence with the pressing ^backspace? If not, does that give some indication as to what is happening?

I see this error mostly first thing in the morning. I use a Bluetooth keyboard.

NOTE: PowerToys Run is never active when I see this error.

crutkas commented 1 year ago

@jaimecbernardo watson has to have a dump for this. We see it enough where we should have a few dmp's

jaimecbernardo commented 1 year ago

@crutkas I've searched watson for the module presented here "system.private.corelib.dll" in all versions of PowerToys and have found no entries for a System.ArgumentException. I suspect that the fact we are catching these exceptions in order to log and show a Window to ask for an issue filing means that it won't ever get sent to Watson.

jaimecbernardo commented 1 year ago

NOTE: PowerToys Run is never active when I see this error.

What do you mean?

BlairLeduc commented 1 year ago

NOTE: PowerToys Run is never active when I see this error.

What do you mean?

Yes, that is a completely useless description. I was attempting to point out, that while another issue report saw this error by pressing ^backspace many times in the PowerToys Run input, I find this waiting for me (sometimes more than one of the same error dialog) in the morning when I wake the laptop.

BlairLeduc commented 1 year ago

I observed the bug in 0.65.0.0.

Version: 0.65.0.0
OS Version: Microsoft Windows NT 10.0.19044.0
IntPtr Length: 8
x64: True
Date: 20/12/2022 06:01:03
Exception:
System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at System.Collections.Generic.List`1.System.Collections.ICollection.CopyTo(Array array, Int32 arrayIndex)
   at System.Collections.ArrayList.InsertRange(Int32 index, ICollection c)
   at System.Windows.Data.ListCollectionView.<RefreshOverride>b__1_0()
   at MS.Internal.Data.SynchronizationInfo.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess)
   at System.Windows.Data.BindingOperations.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess)
   at System.Windows.Data.ListCollectionView.RefreshOverride()
   at System.Windows.Data.CollectionView.RefreshInternal()
   at System.Windows.Data.CollectionView.PostChange(NotifyCollectionChangedEventArgs args)
   at PowerLauncher.ViewModel.MainViewModel.<>c__DisplayClass127_0.<UpdateResultsListViewAfterQuery>b__0()
   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)

Logs: 2022-12-20.txt

BlairLeduc commented 1 year ago

I have observed the bug in 0.67.1.0

Version: 0.67.1.0
OS Version: Microsoft Windows NT 10.0.19044.0
IntPtr Length: 8
x64: True
Date: 09/02/2023 03:28:47 PM
Exception:
System.ArgumentException: Destination array was not long enough. Check the destination index, length, and the array's lower bounds. (Parameter 'destinationArray')
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at System.Collections.Generic.List`1.System.Collections.ICollection.CopyTo(Array array, Int32 arrayIndex)
   at System.Collections.ArrayList.InsertRange(Int32 index, ICollection c)
   at System.Windows.Data.ListCollectionView.<RefreshOverride>b__1_0()
   at MS.Internal.Data.SynchronizationInfo.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess)
   at System.Windows.Data.BindingOperations.AccessCollection(IEnumerable collection, Action accessMethod, Boolean writeAccess)
   at System.Windows.Data.ListCollectionView.RefreshOverride()
   at System.Windows.Data.CollectionView.RefreshInternal()
   at System.Windows.Data.CollectionView.PostChange(NotifyCollectionChangedEventArgs args)
   at PowerLauncher.ViewModel.MainViewModel.<>c__DisplayClass127_0.<UpdateResultsListViewAfterQuery>b__0()
   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)

Logs: 2023-02-09.txt

crutkas commented 1 year ago

from #23413, this might be useful.

Steps to reproduce ALT+SPACE to open PowerToys Run Type any query Press the 'down arrow' key once Press the 'up arrow' key twice. ✔️ Expected Behavior

crutkas commented 1 year ago

Fixed in 0.71 release of PowerToys. aka.ms/installpowertoys