How to crash VS 2010 in 20 lines of code...
-
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[^]. -
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[^]. -
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[^]. -
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[^].J. Dunlap wrote:
Why don't you post the workaround too?
Oxfords English < Official CCC Players Dictionary Excuse me for my improper grammar and typos. It's because English is my primary language, not my first language. My first languages are C# and Java. VB, ASP, JS, PHP and SQL are my second language. Indonesian came as my third language. My fourth language? I'm still creating it, I'll let you know when it's done! :-D
-
J. Dunlap wrote:
Why don't you post the workaround too?
Oxfords English < Official CCC Players Dictionary Excuse me for my improper grammar and typos. It's because English is my primary language, not my first language. My first languages are C# and Java. VB, ASP, JS, PHP and SQL are my second language. Indonesian came as my third language. My fourth language? I'm still creating it, I'll let you know when it's done! :-D
-
J. Dunlap wrote:
Why don't you post the workaround too?
Oxfords English < Official CCC Players Dictionary Excuse me for my improper grammar and typos. It's because English is my primary language, not my first language. My first languages are C# and Java. VB, ASP, JS, PHP and SQL are my second language. Indonesian came as my third language. My fourth language? I'm still creating it, I'll let you know when it's done! :-D
-
-
I'm pretty sure the culprit is indeed the binding logic - it doesn't know whether to bind to the property or the class, so it gets all flustered. But yeah, that code seems simple enough to be sure :laugh:
-
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[^].wow It worked immediately :D
-
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.
-
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[^].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) -
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.
-
-
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[^].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 -
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 -
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[^]. -
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[^].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
-
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[^].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.
-
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[^].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(); }
} -
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[^].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! ;) )