Microsoft Research Community

Welcome to Microsoft Research Community Sign in | Join | Rules
in Search

The AlpineInker

The AlpineInker

Ken Hinckley's blog exploring the savage frontiers of pen, touch, and mobile devices

The official blog of the InkSeine project at Microsoft Research

Tablet PC Managed Code Developers: Visual Studio 2008 Has a Glitch That May Affect You

We've recently started using Visual Studio 2008 for our InkSeine development and have been really very pleased with it so far.

However, we've discovered one gotcha that may affect other Tablet PC developers out there who are using C# managed code, so I wanted to put up a blog post about this. People may encounter this issue and start searching for more information about it.

Under certain conditions, if your code includes an error and you also have Microsoft.Ink.dll as part of your project, the compiler produces a mysterious error.

Here's some example code, where the member variable this.strangeCompilerErrorForUndefinedMembers does not exist in my class:

When I build my project, depending on which file contains this code, the error returned by the compiler will sometimes consist of this wonderfully informative nugget:

Input file 'c:\Windows\assembly\GAC\Microsoft.Ink\1.7.2600.2180__31bf3856ad364e35\Microsoft.Ink.dll' contains invalid metadata

Of course, that's not the real error. There is nothing in fact wrong with Microsoft.Ink.dll. 

The real issue with this glitch is that I can't even click on this error to bring me to the problematic line of code. So if I introduce a coding typo anywhere in my project, I may see this message and have no clue what line of code or even which module is causing the problem. This can make it risky to make a large number of changes to your code before you compile it.

However, if I modify the example code above to remove the "this" pointer:

The compiler then generates the error that it is supposed to:

The name 'strangeCompilerErrorForUndefinedMembers' does not exist in the current context

As far as we can tell, this issue only affects managed code. It also is not specific to undefined member variables; for example, an illegal cast sometimes elicits this error. We also haven't been able to figure out why this bad behavior occurs in some files of our project, but not others. 

We've reported this issue to the Microsoft Visual Studio team and they have been able to reproduce it, although exactly why this happens or how to fix / work around the issue is not yet clear. We have been able to verify that there is nothing in fact wrong with Microsoft.Ink.dll on any of our machines. Hopefully this problem will be cleaned up when the service pack comes along.

 

Comments

No Comments