lbugnion / mvvmlight

The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in Xamarin.Android, Xamarin.iOS, Xamarin.Forms, Windows 10 UWP, Windows Presentation Foundation (WPF), Silverlight, Windows Phone.
http://www.mvvmlight.net
MIT License
1.16k stars 312 forks source link

System.OutOfMemoryException when trying to send message #78

Open EnomisG opened 4 years ago

EnomisG commented 4 years ago

Sometimes when sending a message a OutOfMemoryException was thrown. .net framework 4.0

An unhandled exception just occurred|System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.List`1.set_Capacity(Int32 value)
   at System.Collections.Generic.List`1.EnsureCapacity(Int32 min)
   at System.Collections.Generic.List`1.Add(T item)
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GalaSoft.MvvmLight.Messaging.Messenger.SendToTargetOrType[TMessage](TMessage message, Type messageTargetType, Object token) in c:\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (PCL)\Messaging\Messenger.cs:line 669
   at GalaSoft.MvvmLight.Messaging.Messenger.Send[TMessage](TMessage message) in c:\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (PCL)\Messaging\Messenger.cs:line 259
LeiYangGH commented 3 years ago

is there a demo to reproduce this issue?

Eagle3386 commented 3 years ago

Maybe related to #65? 🤔