M
molafish
I have discovered an upper limit to the size of a string for the Show
() method. It appears that if the string is beyond the limit, the Show
() method fails silently by not showing the messagebox at all. This is
reproducable in the debugger and outside of it (inside the debugger,
the sql string's contents are inspectable, but the message box does
not show).
Here's the code to reproduce it, in a fresh VB.NET solution (VS 2005):
Dim sql As String = My.Computer.FileSystem.ReadAllText
(Application.StartupPath & "\update\update.sql")
MessageBox.Show(sql)
The upper limit appears to be 260,087 bytes for the file. When those
260,087 bytes are entered into a String object, it grows to 18 + (2 *
260087) = 520192. Because the sql object is >85,000 bytes, it's
allocated on the Lagrge Object Heap. At the time I had 95mb of free
memory, 320mb in the system cache, and 1.5gb available through paging.
I suppose I will submit a bug report unless anybody here has an
explanation for why Show() is silently failing. I could check the size
of the string before I show() it, but I would think that Show() should
throw an exception if its input is too large.
() method. It appears that if the string is beyond the limit, the Show
() method fails silently by not showing the messagebox at all. This is
reproducable in the debugger and outside of it (inside the debugger,
the sql string's contents are inspectable, but the message box does
not show).
Here's the code to reproduce it, in a fresh VB.NET solution (VS 2005):
Dim sql As String = My.Computer.FileSystem.ReadAllText
(Application.StartupPath & "\update\update.sql")
MessageBox.Show(sql)
The upper limit appears to be 260,087 bytes for the file. When those
260,087 bytes are entered into a String object, it grows to 18 + (2 *
260087) = 520192. Because the sql object is >85,000 bytes, it's
allocated on the Lagrge Object Heap. At the time I had 95mb of free
memory, 320mb in the system cache, and 1.5gb available through paging.
I suppose I will submit a bug report unless anybody here has an
explanation for why Show() is silently failing. I could check the size
of the string before I show() it, but I would think that Show() should
throw an exception if its input is too large.