CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2009
    Posts
    2

    Cool Bug in C# compiler - InvalidProgramException, Basic Syntax


  2. #2
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Bug in C# compiler - InvalidProgramException, Basic Syntax

    can a nested-class be derived from its parent class? and why would one want to do it? what is the purpose of doing this?
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  3. #3
    Join Date
    May 2007
    Posts
    1,546

    Re: Bug in C# compiler - InvalidProgramException, Basic Syntax

    : base(() => Call()) { }
    That code is probably what's causing the issue. Essentially what you're trying to do is execute code in B before the constructor from B has been run. That's illegal, hence the error. I'm surprised the compiler didn't give out.
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  4. #4
    Join Date
    Dec 2009
    Posts
    2

    Re: Bug in C# compiler - InvalidProgramException, Basic Syntax

    The point is not to make it work. The point is why compiler allows it and maybe some more meaningful exception should be thrown?

  5. #5
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Bug in C# compiler - InvalidProgramException, Basic Syntax

    Quote Originally Posted by lukaszg View Post
    The point is not to make it work. The point is why compiler allows it and maybe some more meaningful exception should be thrown?
    don't you think you should have mentioned it in you first post and not just pasting some links? then you wonder that we didn't guess your intentions.
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured