Click here to Skip to main content

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy.
The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct and please don't post ads.

Technical discussions are welcome, but if you need specific help please use the programming forums.


 
GeneralRe: What is foobar? PinmemberErudite__Eric15-Nov-11 21:48 
GeneralRe: What is foobar? Pinmembervirang_2115-Nov-11 21:53 
GeneralRe: What is foobar? PinmvpAbhinav S15-Nov-11 21:54 
GeneralRe: What is foobar? PinmemberTorstenH.15-Nov-11 22:59 
GeneralRe: What is foobar? PinmemberSlacker00715-Nov-11 23:46 
GeneralRe: What is foobar? PinmemberCDP180215-Nov-11 22:00 
GeneralRe: What is foobar? PinmemberBobJanova16-Nov-11 2:36 
GeneralHow to crash VS 2010 in 20 lines of code... [modified] PinmemberJ. Dunlap15-Nov-11 21:20 
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 | :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[^].

modified 16-Nov-11 3:43am.

GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberRobCroll15-Nov-11 21:36 
GeneralRe: How to crash VS 2010 in 20 lines of code... Pinmember d@nish 15-Nov-11 22:10 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberJ. Dunlap15-Nov-11 22:30 
GeneralRe: How to crash VS 2010 in 20 lines of code... Pinmember d@nish 15-Nov-11 22:37 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberJ. Dunlap15-Nov-11 22:46 
GeneralRe: How to crash VS 2010 in 20 lines of code... Pinmember d@nish 16-Nov-11 0:19 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberFiro Atrum Ventus15-Nov-11 22:14 
GeneralRe: How to crash VS 2010 in 20 lines of code... Pinmember d@nish 15-Nov-11 22:16 
GeneralRe: How to crash VS 2010 in 20 lines of code... PingroupNorm .net16-Nov-11 1:21 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberJ. Dunlap15-Nov-11 22:27 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberKanasz Robert15-Nov-11 22:45 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberSlacker00715-Nov-11 23:41 
GeneralRe: How to crash VS 2010 in 20 lines of code... Pinmemberahmed zahmed16-Nov-11 3:22 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberJ. Dunlap16-Nov-11 7:29 
GeneralRe: How to crash VS 2010 in 20 lines of code... Pinmembersamuelms17-Nov-11 4:12 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberFabio Franco17-Nov-11 5:01 
GeneralRe: How to crash VS 2010 in 20 lines of code... PinmemberMember 294139217-Nov-11 5:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 30 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid