After setting up
log4net, which I can strongly recommend. I noticed that one, and only one of my users kept getting the following error message:
System.OutOfMemoryException: Error creating window handle. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.NativeWindow.WindowClass.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam) ...
After spending hours of investigating and trying to reproduce the error, which I didn't succeed in, I finally found a solution for the problem. After changing the following piece of code
Dim objBeheer As New FrmMyForm
objBeheer.MdiParent = Me
objBeheer.WindowState = FormWindowState.Maximized
objBeheer.Show()
to the following piece of code
Dim objBeheer As New FrmMyForm
objBeheer.MdiParent = Me
objBeheer.Show()
objBeheer.WindowState = FormWindowState.Maximized
the problem was solved. The only thing changed is where the windowstate is set. It still baffles me why only one user got this error. All other users never got this error and they're all working in the same Citrix environment. But in the end of the day the error is solved and there are less errors being logged in my log4net logs :-)