Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. How to crash VS 2010 in 20 lines of code...

How to crash VS 2010 in 20 lines of code...

Scheduled Pinned Locked Moved The Lounge
visual-studiocombeta-testinghelptutorial
28 Posts 17 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J J Dunlap

    namespace Crash
    {
    public class Foo
    {
    public static void Method(object o)
    {

        }
    }
    
    public class Bar
    {
        public Foo Foo { get; set; }
    
        public static void Method(dynamic d)
        {
            Foo.Method(d); //This crashes VS instantly!
        }
    }
    

    }

    :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

    K Offline
    K Offline
    Kanasz Robert
    wrote on last edited by
    #9

    wow It worked immediately :D

    1 Reply Last reply
    0
    • D dan sh

      I think they should enhance intellisense to pick this up and fail the build during initial syntax check (lexical analysis?).

      "The worst code you'll come across is code you wrote last year.", wizardzz[^]

      J Offline
      J Offline
      J Dunlap
      wrote on last edited by
      #10

      Actually it's perfectly valid code which compiles when anything other than a dynamic value is used. It's just that when you use pass in a dynamic value without casting it to a specific type first, the method call expression becomes a dynamic expression that the intellisense engine then crashes from.

      D 1 Reply Last reply
      0
      • J J Dunlap

        namespace Crash
        {
        public class Foo
        {
        public static void Method(object o)
        {

            }
        }
        
        public class Bar
        {
            public Foo Foo { get; set; }
        
            public static void Method(dynamic d)
            {
                Foo.Method(d); //This crashes VS instantly!
            }
        }
        

        }

        :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

        S Offline
        S Offline
        Slacker007
        wrote on last edited by
        #11

        Nice find.

        Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
        "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011)

        1 Reply Last reply
        0
        • J J Dunlap

          Actually it's perfectly valid code which compiles when anything other than a dynamic value is used. It's just that when you use pass in a dynamic value without casting it to a specific type first, the method call expression becomes a dynamic expression that the intellisense engine then crashes from.

          D Offline
          D Offline
          dan sh
          wrote on last edited by
          #12

          OK. Their test cases might have missed out on these and many more conditions. Sorry, but I do not really understand concept of using dynamic. I am still with .Net 3.5 and some VB (yuck!) here and there.

          "The worst code you'll come across is code you wrote last year.", wizardzz[^]

          1 Reply Last reply
          0
          • D dan sh

            Then how we will make fun of and then eventually rant about slow responsiveness of MS guys?

            "The worst code you'll come across is code you wrote last year.", wizardzz[^]

            N Offline
            N Offline
            NormDroid
            wrote on last edited by
            #13

            cue Graus

            Software Kinetics Wear a hard hat it's under construction
            Metro RSS

            1 Reply Last reply
            0
            • J J Dunlap

              namespace Crash
              {
              public class Foo
              {
              public static void Method(object o)
              {

                  }
              }
              
              public class Bar
              {
                  public Foo Foo { get; set; }
              
                  public static void Method(dynamic d)
                  {
                      Foo.Method(d); //This crashes VS instantly!
                  }
              }
              

              }

              :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

              T Offline
              T Offline
              TheGreatAndPowerfulOz
              wrote on last edited by
              #14

              Why don't you post the code into the bugreport too?

              If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
              You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

              J 1 Reply Last reply
              0
              • T TheGreatAndPowerfulOz

                Why don't you post the code into the bugreport too?

                If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
                You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

                J Offline
                J Offline
                J Dunlap
                wrote on last edited by
                #15

                It's in "Steps to reproduce" :-)

                1 Reply Last reply
                0
                • J J Dunlap

                  namespace Crash
                  {
                  public class Foo
                  {
                  public static void Method(object o)
                  {

                      }
                  }
                  
                  public class Bar
                  {
                      public Foo Foo { get; set; }
                  
                      public static void Method(dynamic d)
                      {
                          Foo.Method(d); //This crashes VS instantly!
                      }
                  }
                  

                  }

                  :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                  S Offline
                  S Offline
                  samuelms
                  wrote on last edited by
                  #16

                  This thread became my new google status: "How to crash VS2010[^]" Very cool find. Hard to believe even, I had to try it for myself. :D

                  1 Reply Last reply
                  0
                  • J J Dunlap

                    namespace Crash
                    {
                    public class Foo
                    {
                    public static void Method(object o)
                    {

                        }
                    }
                    
                    public class Bar
                    {
                        public Foo Foo { get; set; }
                    
                        public static void Method(dynamic d)
                        {
                            Foo.Method(d); //This crashes VS instantly!
                        }
                    }
                    

                    }

                    :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                    F Offline
                    F Offline
                    Fabio Franco
                    wrote on last edited by
                    #17

                    Awesome, when I pasted the entire code I, for a second, thought it would be bogus. But then the next second convinced me. I thought it would crash only when trying to use intellisense suggestions when pressing ".".

                    "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

                    1 Reply Last reply
                    0
                    • J J Dunlap

                      namespace Crash
                      {
                      public class Foo
                      {
                      public static void Method(object o)
                      {

                          }
                      }
                      
                      public class Bar
                      {
                          public Foo Foo { get; set; }
                      
                          public static void Method(dynamic d)
                          {
                              Foo.Method(d); //This crashes VS instantly!
                          }
                      }
                      

                      }

                      :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                      S Offline
                      S Offline
                      SeattleC
                      wrote on last edited by
                      #18

                      Shoot. I don't feel like I've really used a version of visual studio until I've crashed the compiler. I specialize in crashing the C++ compiler. I got an error message from vc++ 6 once saying something like "internal error : contact a graduate student." What's up with that? And it was legal C++ too.

                      1 Reply Last reply
                      0
                      • J J Dunlap

                        namespace Crash
                        {
                        public class Foo
                        {
                        public static void Method(object o)
                        {

                            }
                        }
                        
                        public class Bar
                        {
                            public Foo Foo { get; set; }
                        
                            public static void Method(dynamic d)
                            {
                                Foo.Method(d); //This crashes VS instantly!
                            }
                        }
                        

                        }

                        :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                        Sander RosselS Offline
                        Sander RosselS Offline
                        Sander Rossel
                        wrote on last edited by
                        #19

                        Brilliant! :laugh: I had code that crashed VS once too. Don't know what the code was or why it crashed VS. I do know I was in slight panic because it was our entire companies main product that crashed and I couldn't start it up again (I did somehow manage to change the erronous code). Luckily I came back to my senses and simply deleted the code using notepad :laugh:

                        It's an OO world.

                        public class Naerling : Lazy<Person>{
                        public void DoWork(){ throw new NotImplementedException(); }
                        }

                        J 1 Reply Last reply
                        0
                        • J J Dunlap

                          namespace Crash
                          {
                          public class Foo
                          {
                          public static void Method(object o)
                          {

                              }
                          }
                          
                          public class Bar
                          {
                              public Foo Foo { get; set; }
                          
                              public static void Method(dynamic d)
                              {
                                  Foo.Method(d); //This crashes VS instantly!
                              }
                          }
                          

                          }

                          :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                          H Offline
                          H Offline
                          HenryChilvers
                          wrote on last edited by
                          #20

                          Know how to protect yourself from this? Use ReSharper! As soon as you type the "Foo.", ReSharper adds "Crash." in front of it and prevents Visual Studio from having fits! ReSharper, best developer tool, EVER! (possibly even better than Visual Studio! ;) )

                          J 1 Reply Last reply
                          0
                          • J J Dunlap

                            namespace Crash
                            {
                            public class Foo
                            {
                            public static void Method(object o)
                            {

                                }
                            }
                            
                            public class Bar
                            {
                                public Foo Foo { get; set; }
                            
                                public static void Method(dynamic d)
                                {
                                    Foo.Method(d); //This crashes VS instantly!
                                }
                            }
                            

                            }

                            :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                            A Offline
                            A Offline
                            Ayobami Adewole
                            wrote on last edited by
                            #21

                            wow, the moment I copied the code to VS 2010, it crashed immediately

                            1 Reply Last reply
                            0
                            • Sander RosselS Sander Rossel

                              Brilliant! :laugh: I had code that crashed VS once too. Don't know what the code was or why it crashed VS. I do know I was in slight panic because it was our entire companies main product that crashed and I couldn't start it up again (I did somehow manage to change the erronous code). Luckily I came back to my senses and simply deleted the code using notepad :laugh:

                              It's an OO world.

                              public class Naerling : Lazy<Person>{
                              public void DoWork(){ throw new NotImplementedException(); }
                              }

                              J Offline
                              J Offline
                              J Dunlap
                              wrote on last edited by
                              #22

                              Have a 5 vote to counter the uni-voter ;)

                              Sander RosselS 1 Reply Last reply
                              0
                              • H HenryChilvers

                                Know how to protect yourself from this? Use ReSharper! As soon as you type the "Foo.", ReSharper adds "Crash." in front of it and prevents Visual Studio from having fits! ReSharper, best developer tool, EVER! (possibly even better than Visual Studio! ;) )

                                J Offline
                                J Offline
                                J Dunlap
                                wrote on last edited by
                                #23

                                I've had a love-hate relationship with Resharper in the past - a lot of useful functionality but it seemed to slow down the IDE. Has this been fixed in the latest versions?

                                H 1 Reply Last reply
                                0
                                • J J Dunlap

                                  namespace Crash
                                  {
                                  public class Foo
                                  {
                                  public static void Method(object o)
                                  {

                                      }
                                  }
                                  
                                  public class Bar
                                  {
                                      public Foo Foo { get; set; }
                                  
                                      public static void Method(dynamic d)
                                      {
                                          Foo.Method(d); //This crashes VS instantly!
                                      }
                                  }
                                  

                                  }

                                  :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                                  S Offline
                                  S Offline
                                  Shabana Parveen
                                  wrote on last edited by
                                  #24

                                  Awesome finding... bye the way the only line of code which might caused issue is static void Method(dynamic d)!!!

                                  1 Reply Last reply
                                  0
                                  • J J Dunlap

                                    Have a 5 vote to counter the uni-voter ;)

                                    Sander RosselS Offline
                                    Sander RosselS Offline
                                    Sander Rossel
                                    wrote on last edited by
                                    #25

                                    Thanks :) No idea why someone would uni-vote such an innocent post of mine :~

                                    It's an OO world.

                                    public class Naerling : Lazy<Person>{
                                    public void DoWork(){ throw new NotImplementedException(); }
                                    }

                                    1 Reply Last reply
                                    0
                                    • J J Dunlap

                                      namespace Crash
                                      {
                                      public class Foo
                                      {
                                      public static void Method(object o)
                                      {

                                          }
                                      }
                                      
                                      public class Bar
                                      {
                                          public Foo Foo { get; set; }
                                      
                                          public static void Method(dynamic d)
                                          {
                                              Foo.Method(d); //This crashes VS instantly!
                                          }
                                      }
                                      

                                      }

                                      :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                                      U Offline
                                      U Offline
                                      User 3138470
                                      wrote on last edited by
                                      #26

                                      Lol That's why I would never fly airplane having "Genuine windows" logo attached to it...

                                      1 Reply Last reply
                                      0
                                      • J J Dunlap

                                        namespace Crash
                                        {
                                        public class Foo
                                        {
                                        public static void Method(object o)
                                        {

                                            }
                                        }
                                        
                                        public class Bar
                                        {
                                            public Foo Foo { get; set; }
                                        
                                            public static void Method(dynamic d)
                                            {
                                                Foo.Method(d); //This crashes VS instantly!
                                            }
                                        }
                                        

                                        }

                                        :sigh: Took me a bit to figure out what triggers it because when I encountered it, there was a lot of other code involved. But basically the method being called must be static and must be referenced via the class name (without a namespace). The method making the call must also be static, and the class it belongs to must have a non-static property with the same name as the class whose method is being called. The dynamic value being passed to it can come from anywhere - it doesn't have to be an argument to the calling function. The workaround is to use the namespace as well when referencing the class - e.g. Crash.Foo.Method(d). EDIT: I submitted a bug report here[^].

                                        E Offline
                                        E Offline
                                        edmurphy99
                                        wrote on last edited by
                                        #27

                                        public Foo Foo { get; set; }

                                        to

                                        public Foo foo { get; set; }

                                        seems to work now if you want to reboot your system run this

                                        #include
                                        int main( void )
                                        {
                                        for( ;; )
                                        {
                                        printf( "hung up\t\t\b\b\b\b\b\b" );
                                        }
                                        return 0;
                                        }

                                        1 Reply Last reply
                                        0
                                        • J J Dunlap

                                          I've had a love-hate relationship with Resharper in the past - a lot of useful functionality but it seemed to slow down the IDE. Has this been fixed in the latest versions?

                                          H Offline
                                          H Offline
                                          HenryChilvers
                                          wrote on last edited by
                                          #28

                                          It has been improved in the latest few versions (although I haven't upgraded to the latest latest one). Also, running on a quad core, 64-bit Windows 7 box with 8 GBs of RAM doesn't hurt either! :-D

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups