A bug in embedded Internet Explorer in Windows 8

Long-time readers of this site may remember that I did some work on embedding Internet Explorer, and its core rendering component MSHTML, in .NET applications. The code is still online.

I noticed that it does not work properly in Windows 8 Consumer Preview. Specifically, plain HTML works but you can no longer apply external CSS stylesheets. I reported the bug here (sign-in required).  I did not use my own component, but rather the standard WebBrowser control. I have appended the code to reproduce the bug in case you cannot see the report.

Microsoft has now responded as follows:

We were able to validate your feedback. However, based on the limited impact this bug may have, we will not be able to address this bug during this release.

This status is also known as “won’t fix” and gives me pause for thought. How many other little bugs are there which Microsoft is not fixing, but which break a certain number of applications?

If you are one of those few people using embedded IE in an application, I suggest checking Windows 8 compatibility now to avoid any unpleasant surprises.

Perhaps it would be preferable to use WebKit or Gecko (Mozilla) rather than IE in any case. There is a thread on stackoverflow that discusses some options. OpenWebKitSharp looks promising.

Code to reproduce the bug:

Create a Windows Forms application in C# in VS 11. Add a Webbrowser control and two buttons, and an OpenFileDialog control. Also add a reference to the COM library Microsoft HTML Object Library.

Here is the code for the first button that loads some HTML:

string sHTML = "<html><head><title>Some title</title></head><body><p>Some text</p></body></html>";
this.webBrowser1.DocumentText = sHTML;

Here is the code for the second button that applies a stylesheet:

openFileDialog1.Filter = "CSS files|*.css";
if (openFileDialog1.ShowDialog() == DialogResult.OK)  {
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)this.webBrowser1.Document.DomDocument;
doc.createStyleSheet(openFileDialog1.FileName);
}

This is the stylesheet I am applying:

body
{
    font-family: Arial;
    font-size: 18pt;
}

To reproduce, run the application. Click the first button to load the HTML. Then click the second button to apply the stylesheet. In Windows 7 and earlier the stylesheet is applied. In Windows 8, the stylesheet is not applied.

UPDATE: It seems this bug was fixed in Windows 8 RTM, despite the “will not fix” designation. Good.

2 thoughts on “A bug in embedded Internet Explorer in Windows 8”

  1. Speaking of IE bugs, if you have any Adobe Type 1 fonts lying around you might check if IE9’s catastrophic rendering bug has been fixed in IE10.

    The IE9 rendering engine halts or even crashes when a web page requests certain popular AT1 fonts including Courier, Helvetica, and Times – possibly others. These fonts are often referenced in style sheets and come with basic Type 1 font packages, so it’s easy to trigger this bug if you use any Type 1 fonts at all (.pfb/.pfm).

    This is the blog post where I found the first report on this amazing bug:
    http://oddballupdate.com/2011/08/13/internet-explorer-9-helvetica-type-1-and-you/

    The MSDN Forums thread which confirms that this is a known “won’t fix” bug:
    http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/6c12cdb5-dfad-49a0-a29e-8cb2e8b8c1c1

  2. Tim, as far as I know, embedded Gecko is broken and effectively abandoned at the moment. WebKit, of course, is eminently embeddable.

Comments are closed.