Dodgy font killing application?

B

Brett O'Callaghan

I have an application, one evening it was working fine, the next
morning it's dead. I don't know what has changed in that time.

It appears to be dying on the line of code setting the font of a
listview control, ie

Me.lvStatus.Font = New System.Drawing.Font("Microsoft Sans Serif",
9.0!, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))


This is the error, any suggestions at all appreciated!

Object reference not set to an instance of an object
at
System.Drawing.SafeNativeMethods.GdipCreateFontFromLogfontW(HandleRef
hdc, Object lf, IntPtr& font)
at System.Drawing.Font.FromLogFont(Object lf, IntPtr hdc)
at System.Drawing.Font.FromHfont(IntPtr hfont)
at System.Windows.Forms.Control.get_DefaultFont()
at System.Windows.Forms.Control.get_Font()
at System.Windows.Forms.ListView..ctor()
at CS.frmMain.InitializeComponent()
at CS.frmMain..ctor()
at CS.main.CreateObjects()
at CS.main.main()
 
B

Brett O'Callaghan

I have an application, one evening it was working fine, the next
morning it's dead. I don't know what has changed in that time.

Following up my own post - it turns out all my problems on this
machine were caused by a corrupted gdiplus.dll. 4 Bytes in the 1.7MB
file were not what they should have been.

This is a little troubling - I frankly would have expected DotNet to
give me a slightly more useful error message than -

Object reference not set to an instance of an object
at
System.Drawing.SafeNativeMethods.GdipCreateFontFromLogfontW(HandleRef
hdc, Object lf, IntPtr& font)

Does DotNet not verify library files before loading them?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top