Invalid syntax in an expression that is 'too complex to compile' causes Visual Studio to crash reliably. - by the-configurator

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


3
0
Sign in
to vote
ID 643839 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 2/14/2011 4:12:37 AM
Access Restriction Public

Description

If a class file in a project contains the following code, Visual Studio crashes every time the solution is opened (I believe only if the file is also opened).
This is a derivative of the code from Eric Lippert's Revenge of the Cycle Detector post ( http://blogs.msdn.com/b/ericlippert/archive/2004/03/22/revenge-of-the-cycle-detector.aspx ), with a slight change that makes the IC definition syntax invalid. The crash only happens if the Main method is actually there with this code.

class P {
  interface IN<in U> { }
  interface IC<X> : IN<IN<IC<X>>>> { }

  static void Main() {
    IC<double> bar = null;
    IN<IC<string>> foo = bar;
  }
}
Sign in to post a comment.
Posted by Alex [MSFT] on 4/4/2011 at 2:10 PM
Thanks for reporting this issue you've encountered with Visual Studio!

This is quite the nasty bug, especially as the code required to reproduce the issue is so short! As you point out, the issue here resides in the cycle detection algorithm the compiler uses as it resolves generic types. Eric Lippert himself spent about a month working to rewrite this algorithm in a previous release, but we had to pull up, as this was such a sensitive area of the compiler.

Unfortunately, we won't be able to fix this bug in the next version of Visual Studio. However, as we also continue work on our compiler-as-a-service rewrite, this algorithm will necessarily be reimplemented, hopefully in a manner that remains robust in the face of the generic type definition you provided - stay tuned!

Alex Turner
Program Manager
Visual Basic and C# Compiler
Posted by Sean [MSFT] on 2/19/2011 at 7:50 PM
Hi The-Configurator,

We've been able to reproduce this issue and it has now be assigned for investigation.

Thanks!
-Sean Laberee
VS Pro Team
Posted by Microsoft on 2/17/2011 at 1:26 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Microsoft on 2/14/2011 at 4:58 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)