Friday, 23 September 2011

Quickest way to generate OutOfMemory exception

One of the quickest way (I am sure there are many) to reproduce an OutOfMem exception in .NET:

1> Drag a textbox on WPF window

2> In XAML, set TextChanged event on the added text box

3> In the TextChanged event, write a line which sets a text on the same textbox which generates this event
for .e.g txtCheckException.Text = “something”;

4> Run the application and enter a keystroke in the textbox.

Error

The event would raised again and again, and very soon (well seconds) you will get the OutOfMemory exception.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.