Quantcast
Channel: HTML Renderer
Viewing all articles
Browse latest Browse all 693

Commented Unassigned: NullReference on x64 Win7 AnyCPU configuration [9059]

$
0
0
On Win7 x64 and a defined AnyCPU build configuration, I get a NullRefernce Exception on calling the Win32 method "GetTextMetrics"

The problem is inside the interop definition in: _../Source/HtmlRenderer.WinForms/Utilities/Win32Utils.cs_

The definition have to be changed from CharSet.Auto to CharSet.Ansi.
Here the correct definition:
[DllImport("gdi32.dll", CharSet = CharSet.__Ansi__)]
public static extern bool GetTextMetrics(IntPtr hdc, out TextMetric lptm);


Comments: fucking pInvoke crap #$@#$ sorry about that. Another developer had the same issue, see [Fails while debugging in VS](https://htmlrenderer.codeplex.com/workitem/9056), so I have updated the code to explicitly use Unicode charset. Please try it because ansi will not work properly with non English characters. Are you using VS 2010? Do you see it only when running from VS?

Viewing all articles
Browse latest Browse all 693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>