Problem with virtual method

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gerry

    #16
    Re: Problem with virtual method

    JonD - take some advice - add the skeeter to your ignore list.


    "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
    news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...[color=blue]
    > I should point out that my project is not currently open source and as[/color]
    such[color=blue]
    > it is private. I am not going to post the entire project nor link to it,[/color]
    it[color=blue]
    > would be a waste of your time anyway (Mr. Skeet).
    >
    > I should also point out that I cannot simply remove code until the problem
    > fixes itself.
    >
    > 1. I don't know what to delete.
    > 2. If I do delete anything, it will break the entire project.
    > 3. I cannot simply paste the code into a new project because there are[/color]
    far[color=blue]
    > too many interdependent classes and types and methods, etc.
    >
    > Finally, I should point out that, while we must try to be respectful to
    > those who help, those who help should be respectful of these (above)
    > hindrances. I've done the best I can to provide what I know without[/color]
    posting[color=blue]
    > a link to the entire solution in a .zip file, short of rewriting code from
    > scratch on this matter, which, as I said, will negate the usefulness of[/color]
    this[color=blue]
    > group.
    >
    > Seems I have no choice, which is fine. Nobody owes me anything.
    >
    > Thanks again for the willingness to try to help. Please put your tired[/color]
    self[color=blue]
    > to rest.
    >
    > Jon
    >
    >
    > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
    > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..[color=green]
    > > Jon, it took me about half an hour to hand-pick the relevant lines of[/color][/color]
    code[color=blue][color=green]
    > > that would be useful to you. You are insistent on not visually[/color][/color]
    evaluating[color=blue][color=green]
    > > what I wrote, which is your prerogative.
    > >
    > > Developing sample code that reproduces the problem is only possible if[/color][/color]
    you[color=blue][color=green]
    > > know how to reproduce the problem, and I don't know how to reproduce the
    > > problem. Obviously if someone in this group cannot help me drill down to[/color]
    > the[color=green]
    > > problem with the information I provided and without a full reproduction,
    > > then, in order to provide a reproduction of the problem, I will have to
    > > rewrite from the ground up, adding line by line what I've done, until I
    > > discover the culprit (hence, I find what makes it reproduceable). But[/color][/color]
    that[color=blue][color=green]
    > > will take days, and by the time I find the culprit I won't need this
    > > newsgroup.
    > >
    > > Thanks anyway.
    > >
    > > Jon
    > >
    > >
    > > "Jon Skeet" <skeet@pobox.co m> wrote in message
    > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...[color=darkred]
    > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
    > > > > > But there was - if you'd posted a short but complete example which
    > > > > > *wasn't* working on your box,
    > > > >
    > > > > But see I couldn't do that without giving you everything.
    > > >
    > > > But you could. You could have reduced the code gradually (a copy of[/color][/color][/color]
    the[color=blue][color=green][color=darkred]
    > > > code, rather) until it worked. That would actually have shown you the
    > > > error very quickly (see below) due to what the problem turned out to
    > > > be. If the problem *had* been in the code, however, you would then[/color][/color][/color]
    have[color=blue][color=green][color=darkred]
    > > > found it when it went from "not working" to "working". Either way,
    > > > you'd have found the problem in the end.
    > > >
    > > > > There was absolutely no way to help you help me by reproducing[/color][/color][/color]
    sample[color=blue][color=green]
    > > code[color=darkred]
    > > > > in new project code because I wouldn't have repeated the same error[/color]
    > > (unless[color=darkred]
    > > > > per chance I actually caught myself along the way).
    > > >
    > > > Which you should have done, because immediately after copying the full
    > > > code, the first thing to do would be to test that it still didn't[/color][/color][/color]
    work.[color=blue][color=green][color=darkred]
    > > >
    > > > > Thanks again for your insightful question (re your previous post,[/color]
    > > "Release[color=darkred]
    > > > > mode"), it actually really helped me drill down to the problem, and[/color]
    > > frankly[color=darkred]
    > > > > I don't know how else I would have found my error.
    > > >
    > > > See above.
    > > >
    > > > --
    > > > Jon Skeet - <skeet@pobox.co m>
    > > > http://www.pobox.com/~skeet/
    > > > If replying to the group, please do not mail me too[/color]
    > >
    > >[/color]
    >
    >[/color]


    Comment

    • Jon Davis

      #17
      Re: Problem with virtual method

      I did that yesterday .. thx

      Jon

      "gerry" <germ@hotmail.c om> wrote in message
      news:%23NN9fc6T DHA.2252@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > JonD - take some advice - add the skeeter to your ignore list.
      >
      >
      > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
      > news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...[color=green]
      > > I should point out that my project is not currently open source and as[/color]
      > such[color=green]
      > > it is private. I am not going to post the entire project nor link to it,[/color]
      > it[color=green]
      > > would be a waste of your time anyway (Mr. Skeet).
      > >
      > > I should also point out that I cannot simply remove code until the[/color][/color]
      problem[color=blue][color=green]
      > > fixes itself.
      > >
      > > 1. I don't know what to delete.
      > > 2. If I do delete anything, it will break the entire project.
      > > 3. I cannot simply paste the code into a new project because there are[/color]
      > far[color=green]
      > > too many interdependent classes and types and methods, etc.
      > >
      > > Finally, I should point out that, while we must try to be respectful to
      > > those who help, those who help should be respectful of these (above)
      > > hindrances. I've done the best I can to provide what I know without[/color]
      > posting[color=green]
      > > a link to the entire solution in a .zip file, short of rewriting code[/color][/color]
      from[color=blue][color=green]
      > > scratch on this matter, which, as I said, will negate the usefulness of[/color]
      > this[color=green]
      > > group.
      > >
      > > Seems I have no choice, which is fine. Nobody owes me anything.
      > >
      > > Thanks again for the willingness to try to help. Please put your tired[/color]
      > self[color=green]
      > > to rest.
      > >
      > > Jon
      > >
      > >
      > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
      > > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..[color=darkred]
      > > > Jon, it took me about half an hour to hand-pick the relevant lines of[/color][/color]
      > code[color=green][color=darkred]
      > > > that would be useful to you. You are insistent on not visually[/color][/color]
      > evaluating[color=green][color=darkred]
      > > > what I wrote, which is your prerogative.
      > > >
      > > > Developing sample code that reproduces the problem is only possible if[/color][/color]
      > you[color=green][color=darkred]
      > > > know how to reproduce the problem, and I don't know how to reproduce[/color][/color][/color]
      the[color=blue][color=green][color=darkred]
      > > > problem. Obviously if someone in this group cannot help me drill down[/color][/color][/color]
      to[color=blue][color=green]
      > > the[color=darkred]
      > > > problem with the information I provided and without a full[/color][/color][/color]
      reproduction,[color=blue][color=green][color=darkred]
      > > > then, in order to provide a reproduction of the problem, I will have[/color][/color][/color]
      to[color=blue][color=green][color=darkred]
      > > > rewrite from the ground up, adding line by line what I've done, until[/color][/color][/color]
      I[color=blue][color=green][color=darkred]
      > > > discover the culprit (hence, I find what makes it reproduceable). But[/color][/color]
      > that[color=green][color=darkred]
      > > > will take days, and by the time I find the culprit I won't need this
      > > > newsgroup.
      > > >
      > > > Thanks anyway.
      > > >
      > > > Jon
      > > >
      > > >
      > > > "Jon Skeet" <skeet@pobox.co m> wrote in message
      > > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...
      > > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
      > > > > > > But there was - if you'd posted a short but complete example[/color][/color][/color]
      which[color=blue][color=green][color=darkred]
      > > > > > > *wasn't* working on your box,
      > > > > >
      > > > > > But see I couldn't do that without giving you everything.
      > > > >
      > > > > But you could. You could have reduced the code gradually (a copy of[/color][/color]
      > the[color=green][color=darkred]
      > > > > code, rather) until it worked. That would actually have shown you[/color][/color][/color]
      the[color=blue][color=green][color=darkred]
      > > > > error very quickly (see below) due to what the problem turned out to
      > > > > be. If the problem *had* been in the code, however, you would then[/color][/color]
      > have[color=green][color=darkred]
      > > > > found it when it went from "not working" to "working". Either way,
      > > > > you'd have found the problem in the end.
      > > > >
      > > > > > There was absolutely no way to help you help me by reproducing[/color][/color]
      > sample[color=green][color=darkred]
      > > > code
      > > > > > in new project code because I wouldn't have repeated the same[/color][/color][/color]
      error[color=blue][color=green][color=darkred]
      > > > (unless
      > > > > > per chance I actually caught myself along the way).
      > > > >
      > > > > Which you should have done, because immediately after copying the[/color][/color][/color]
      full[color=blue][color=green][color=darkred]
      > > > > code, the first thing to do would be to test that it still didn't[/color][/color]
      > work.[color=green][color=darkred]
      > > > >
      > > > > > Thanks again for your insightful question (re your previous post,
      > > > "Release
      > > > > > mode"), it actually really helped me drill down to the problem,[/color][/color][/color]
      and[color=blue][color=green][color=darkred]
      > > > frankly
      > > > > > I don't know how else I would have found my error.
      > > > >
      > > > > See above.
      > > > >
      > > > > --
      > > > > Jon Skeet - <skeet@pobox.co m>
      > > > > http://www.pobox.com/~skeet/
      > > > > If replying to the group, please do not mail me too
      > > >
      > > >[/color]
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Jon Skeet

        #18
        Re: Problem with virtual method

        [I realise you won't even see this if you really have added me to your
        killfile. Shame, but there we go.]

        Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:[color=blue]
        > QUESTION: What on EARTH would disable the virtualness of a virtual method
        > except something (??) among the few lines of code that I posted?[/color]

        I don't know - but until I can see it failing on my own box, I'll be as
        baffled as you are.
        [color=blue]
        > There is NO WAY that the other code, the business rules, which has NOTHING
        > to do with virtualness of the method, has anything to do with this problem.
        > This IS a bug in the Framework.[/color]

        It's possible - but I've seen that kind of certainty end up being
        misplaced far too often to just believe it on your word, I'm afraid.
        [color=blue]
        > I have decided to make the method abstract.[/color]

        If it works, that's great :)

        If you still have a copy of the failing project, large as it is, I'd be
        fascinated to have a look at it. I realise it's private - I'm happy to
        sign any NDAs etc. If it *is* a bug in the framework, it's pretty
        important to get it looked at - and I'm confident that I *would* be
        able to get rid of a lot of the business logic to get a small working
        (or rather failing) example given the whole thing.

        --
        Jon Skeet - <skeet@pobox.co m>
        Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

        If replying to the group, please do not mail me too

        Comment

        • Jon Davis

          #19
          Re: Problem with virtual method

          Okay, making it abstract did help me identify that this was an assembly
          loading problem. I have fixed the assembly loading problem and the problem
          is resolved--the child class is FINALLY being executed, even after reverting
          back to virtual (YAAAAY!!).

          I still perceive this to be a flaw in the Framework. There should have been
          an error output indicating that the assembly did not load correctly. QUITE
          UNACCEPTABLE, Microsoft. I wasted at least two weeks on this.

          Jon


          "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
          news:%23PJAFROU DHA.304@tk2msft ngp13.phx.gbl.. .[color=blue]
          > QUESTION: What on EARTH would disable the virtualness of a virtual method
          > except something (??) among the few lines of code that I posted?
          >
          > There is NO WAY that the other code, the business rules, which has NOTHING
          > to do with virtualness of the method, has anything to do with this[/color]
          problem.[color=blue]
          > This IS a bug in the Framework.
          >
          > I have decided to make the method abstract.
          >
          > Jon
          >
          >
          > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@ema il.msn.com> wrote in[/color]
          message[color=blue]
          > news:ughBIWtTDH A.560@TK2MSFTNG P10.phx.gbl...[color=green]
          > > Jon,
          > > Go the other direction!
          > >
          > > Start a new solution with two projects. The first project loads the[/color][/color]
          second[color=blue][color=green]
          > > project and calls the virtual method. Include the minimalist amount of[/color]
          > code[color=green]
          > > to demonstrate the feature. Does it work?
          > >
          > > Start adding features from your larger project, until this new project
          > > fails. Baby steps! Add things one at a time. Hopefully when you added X,[/color]
          > it[color=green]
          > > fails, then you know to look at X in the larger project.
          > >
          > > This helps solves two problems.
          > > 1. It gives you a reference point to compare to the larger project.
          > > 2. It proves what you are attempting to do works, or doesn't work.[/color][/color]
          Without[color=blue][color=green]
          > > being bothered by the shear volume of the rest of your main project.
          > >
          > > 3. It also provides a small project that fails, which is what Jon Skeet[/color]
          > was[color=green]
          > > asking for.
          > >
          > > Hope this helps
          > > Jay
          > >
          > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
          > > news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...[color=darkred]
          > > > I should point out that my project is not currently open source and as[/color]
          > > such[color=darkred]
          > > > it is private. I am not going to post the entire project nor link to[/color][/color][/color]
          it,[color=blue][color=green]
          > > it[color=darkred]
          > > > would be a waste of your time anyway (Mr. Skeet).
          > > >
          > > > I should also point out that I cannot simply remove code until the[/color][/color]
          > problem[color=green][color=darkred]
          > > > fixes itself.
          > > >
          > > > 1. I don't know what to delete.
          > > > 2. If I do delete anything, it will break the entire project.
          > > > 3. I cannot simply paste the code into a new project because there[/color][/color][/color]
          are[color=blue][color=green]
          > > far[color=darkred]
          > > > too many interdependent classes and types and methods, etc.
          > > >
          > > > Finally, I should point out that, while we must try to be respectful[/color][/color][/color]
          to[color=blue][color=green][color=darkred]
          > > > those who help, those who help should be respectful of these (above)
          > > > hindrances. I've done the best I can to provide what I know without[/color]
          > > posting[color=darkred]
          > > > a link to the entire solution in a .zip file, short of rewriting code[/color][/color]
          > from[color=green][color=darkred]
          > > > scratch on this matter, which, as I said, will negate the usefulness[/color][/color][/color]
          of[color=blue][color=green]
          > > this[color=darkred]
          > > > group.
          > > >
          > > > Seems I have no choice, which is fine. Nobody owes me anything.
          > > >
          > > > Thanks again for the willingness to try to help. Please put your tired[/color]
          > > self[color=darkred]
          > > > to rest.
          > > >
          > > > Jon
          > > >
          > > >
          > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
          > > > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..
          > > > > Jon, it took me about half an hour to hand-pick the relevant lines[/color][/color][/color]
          of[color=blue][color=green]
          > > code[color=darkred]
          > > > > that would be useful to you. You are insistent on not visually[/color]
          > > evaluating[color=darkred]
          > > > > what I wrote, which is your prerogative.
          > > > >
          > > > > Developing sample code that reproduces the problem is only possible[/color][/color][/color]
          if[color=blue][color=green]
          > > you[color=darkred]
          > > > > know how to reproduce the problem, and I don't know how to reproduce[/color][/color]
          > the[color=green][color=darkred]
          > > > > problem. Obviously if someone in this group cannot help me drill[/color][/color][/color]
          down[color=blue]
          > to[color=green][color=darkred]
          > > > the
          > > > > problem with the information I provided and without a full[/color][/color]
          > reproduction,[color=green][color=darkred]
          > > > > then, in order to provide a reproduction of the problem, I will have[/color][/color]
          > to[color=green][color=darkred]
          > > > > rewrite from the ground up, adding line by line what I've done,[/color][/color][/color]
          until[color=blue]
          > I[color=green][color=darkred]
          > > > > discover the culprit (hence, I find what makes it reproduceable).[/color][/color][/color]
          But[color=blue][color=green]
          > > that[color=darkred]
          > > > > will take days, and by the time I find the culprit I won't need this
          > > > > newsgroup.
          > > > >
          > > > > Thanks anyway.
          > > > >
          > > > > Jon
          > > > >
          > > > >
          > > > > "Jon Skeet" <skeet@pobox.co m> wrote in message
          > > > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...
          > > > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
          > > > > > > > But there was - if you'd posted a short but complete example[/color][/color]
          > which[color=green][color=darkred]
          > > > > > > > *wasn't* working on your box,
          > > > > > >
          > > > > > > But see I couldn't do that without giving you everything.
          > > > > >
          > > > > > But you could. You could have reduced the code gradually (a copy[/color][/color][/color]
          of[color=blue][color=green]
          > > the[color=darkred]
          > > > > > code, rather) until it worked. That would actually have shown you[/color][/color]
          > the[color=green][color=darkred]
          > > > > > error very quickly (see below) due to what the problem turned out[/color][/color][/color]
          to[color=blue][color=green][color=darkred]
          > > > > > be. If the problem *had* been in the code, however, you would then[/color]
          > > have[color=darkred]
          > > > > > found it when it went from "not working" to "working". Either way,
          > > > > > you'd have found the problem in the end.
          > > > > >
          > > > > > > There was absolutely no way to help you help me by reproducing[/color]
          > > sample[color=darkred]
          > > > > code
          > > > > > > in new project code because I wouldn't have repeated the same[/color][/color]
          > error[color=green][color=darkred]
          > > > > (unless
          > > > > > > per chance I actually caught myself along the way).
          > > > > >
          > > > > > Which you should have done, because immediately after copying the[/color][/color]
          > full[color=green][color=darkred]
          > > > > > code, the first thing to do would be to test that it still didn't[/color]
          > > work.[color=darkred]
          > > > > >
          > > > > > > Thanks again for your insightful question (re your previous[/color][/color][/color]
          post,[color=blue][color=green][color=darkred]
          > > > > "Release
          > > > > > > mode"), it actually really helped me drill down to the problem,[/color][/color]
          > and[color=green][color=darkred]
          > > > > frankly
          > > > > > > I don't know how else I would have found my error.
          > > > > >
          > > > > > See above.
          > > > > >
          > > > > > --
          > > > > > Jon Skeet - <skeet@pobox.co m>
          > > > > > http://www.pobox.com/~skeet/
          > > > > > If replying to the group, please do not mail me too
          > > > >
          > > > >
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Jon Davis

            #20
            Re: Problem with virtual method


            "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
            news:%237BZ36pT DHA.2316@tk2msf tngp13.phx.gbl. ..[color=blue]
            >
            > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
            > news:untl3npTDH A.2004@TK2MSFTN GP11.phx.gbl...[color=green]
            > > "Jon Skeet" <skeet@pobox.co m> wrote in message
            > > news:MPG.19845e 59d982c86598a17 1@news.microsof t.com...[color=darkred]
            > > > Have you tried running the code in release mode? Maybe it's just a
            > > > debugger bug.[/color]
            > >
            > > Ah, a helpful, insightful answer that doesn't involve your copy-pasting[/color]
            > into[color=green]
            > > the debugger (which I can do)!
            > >
            > > Actually, this answer made me realize that files were not being properly
            > > propogated to the proper directories upon compile. Hopefully that's my
            > > problem, still testing ...[/color]
            >
            > Hmm, nope, this wasn't the problem. The problem remains.
            >
            > .. Time to find other resources ..
            >
            >
            >[/color]

            Okay, making it abstract did help me identify that this was an assembly
            loading problem. I have fixed the assembly loading problem and the problem
            is resolved--the child class is FINALLY being executed, even after reverting
            back to virtual (YAAAAY!!).

            I still perceive this to be a flaw in the Framework. There should have been
            an error output indicating that the assembly did not load correctly. QUITE
            UNACCEPTABLE, Microsoft. I wasted at least two weeks on this.

            Jon


            Comment

            • Jon Skeet

              #21
              Re: Problem with virtual method

              [Posted and mailed.]

              Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:[color=blue]
              > Okay, making it abstract did help me identify that this was an assembly
              > loading problem. I have fixed the assembly loading problem and the problem
              > is resolved--the child class is FINALLY being executed, even after reverting
              > back to virtual (YAAAAY!!).
              >
              > I still perceive this to be a flaw in the Framework. There should have been
              > an error output indicating that the assembly did not load correctly. QUITE
              > UNACCEPTABLE, Microsoft. I wasted at least two weeks on this.[/color]

              So you now have the same code as you had before, but it's working? That
              sounds like it's *more likely* to be either a flaw in your build/deploy
              environment, or in VS.NET. It *could* still be a bug in the framework,
              but I think it's unlikely. (Just my opinion, of course.)

              Do you still have a copy of the dll/exes which didn't work? It could
              well be instructive to look at the metadata in there, and compare it
              with the working version.

              --
              Jon Skeet - <skeet@pobox.co m>
              Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

              If replying to the group, please do not mail me too

              Comment

              • Jon Davis

                #22
                Re: Problem with virtual method

                From what I could tell, one of two things happened, both of which, I
                suppose, is a "framework flaw by design"--that is, my own error because of
                some things I didn't know to look for:

                1. The child type was null:
                BaseObject obj =
                Activator.Creat eInstance(loade dAssemblies.get ChildType()); //
                returned null
                obj.VirtualMeth od(); // executed method from base object because obj is
                null

                or

                2. The DLL was locked by Visual Studio .NET because it was open in my
                solution:
                BaseObject obj =
                Activator.Creat eInstance(loade dAssemblies.get ChildType()); //
                returned a Type, but assembly was locked
                obj.VirtualMeth od(); // executed method from base object because DLL
                from obj is locked

                In any case, I knew the DLL was indeed being locked because after making
                everything abstract and recompiling, I started monitoring assembly.GetTyp e()
                and GetType() was returning null and when I tried GetTypes() I got an error
                message.

                SOOOOOO ... I suppose the problem was indeed my fault because I used this:

                Type t = assem.GetType(c lrName);

                ... instead of ..

                Type t = assem.GetType(c lrName, true);



                Jon



                "Niall" <asdf@me.com> wrote in message
                news:OKnhBqOUDH A.3796@tk2msftn gp13.phx.gbl...[color=blue]
                > What exactly was the assembly loading error/what was the cause?
                >
                > Niall
                >
                > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                > news:uV7EplOUDH A.1364@TK2MSFTN GP10.phx.gbl...[color=green]
                > > Okay, making it abstract did help me identify that this was an assembly
                > > loading problem. I have fixed the assembly loading problem and the[/color][/color]
                problem[color=blue][color=green]
                > > is resolved--the child class is FINALLY being executed, even after[/color]
                > reverting[color=green]
                > > back to virtual (YAAAAY!!).
                > >
                > > I still perceive this to be a flaw in the Framework. There should have[/color]
                > been[color=green]
                > > an error output indicating that the assembly did not load correctly.[/color][/color]
                QUITE[color=blue][color=green]
                > > UNACCEPTABLE, Microsoft. I wasted at least two weeks on this.
                > >
                > > Jon
                > >
                > >
                > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                > > news:%23PJAFROU DHA.304@tk2msft ngp13.phx.gbl.. .[color=darkred]
                > > > QUESTION: What on EARTH would disable the virtualness of a virtual[/color][/color]
                > method[color=green][color=darkred]
                > > > except something (??) among the few lines of code that I posted?
                > > >
                > > > There is NO WAY that the other code, the business rules, which has[/color][/color]
                > NOTHING[color=green][color=darkred]
                > > > to do with virtualness of the method, has anything to do with this[/color]
                > > problem.[color=darkred]
                > > > This IS a bug in the Framework.
                > > >
                > > > I have decided to make the method abstract.
                > > >
                > > > Jon
                > > >
                > > >
                > > > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@ema il.msn.com> wrote in[/color]
                > > message[color=darkred]
                > > > news:ughBIWtTDH A.560@TK2MSFTNG P10.phx.gbl...
                > > > > Jon,
                > > > > Go the other direction!
                > > > >
                > > > > Start a new solution with two projects. The first project loads the[/color]
                > > second[color=darkred]
                > > > > project and calls the virtual method. Include the minimalist amount[/color][/color][/color]
                of[color=blue][color=green][color=darkred]
                > > > code
                > > > > to demonstrate the feature. Does it work?
                > > > >
                > > > > Start adding features from your larger project, until this new[/color][/color][/color]
                project[color=blue][color=green][color=darkred]
                > > > > fails. Baby steps! Add things one at a time. Hopefully when you[/color][/color][/color]
                added[color=blue]
                > X,[color=green][color=darkred]
                > > > it
                > > > > fails, then you know to look at X in the larger project.
                > > > >
                > > > > This helps solves two problems.
                > > > > 1. It gives you a reference point to compare to the larger project.
                > > > > 2. It proves what you are attempting to do works, or doesn't work.[/color]
                > > Without[color=darkred]
                > > > > being bothered by the shear volume of the rest of your main project.
                > > > >
                > > > > 3. It also provides a small project that fails, which is what Jon[/color][/color]
                > Skeet[color=green][color=darkred]
                > > > was
                > > > > asking for.
                > > > >
                > > > > Hope this helps
                > > > > Jay
                > > > >
                > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                > > > > news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...
                > > > > > I should point out that my project is not currently open source[/color][/color][/color]
                and[color=blue]
                > as[color=green][color=darkred]
                > > > > such
                > > > > > it is private. I am not going to post the entire project nor link[/color][/color][/color]
                to[color=blue][color=green]
                > > it,[color=darkred]
                > > > > it
                > > > > > would be a waste of your time anyway (Mr. Skeet).
                > > > > >
                > > > > > I should also point out that I cannot simply remove code until the
                > > > problem
                > > > > > fixes itself.
                > > > > >
                > > > > > 1. I don't know what to delete.
                > > > > > 2. If I do delete anything, it will break the entire project.
                > > > > > 3. I cannot simply paste the code into a new project because[/color][/color][/color]
                there[color=blue][color=green]
                > > are[color=darkred]
                > > > > far
                > > > > > too many interdependent classes and types and methods, etc.
                > > > > >
                > > > > > Finally, I should point out that, while we must try to be[/color][/color][/color]
                respectful[color=blue][color=green]
                > > to[color=darkred]
                > > > > > those who help, those who help should be respectful of these[/color][/color][/color]
                (above)[color=blue][color=green][color=darkred]
                > > > > > hindrances. I've done the best I can to provide what I know[/color][/color][/color]
                without[color=blue][color=green][color=darkred]
                > > > > posting
                > > > > > a link to the entire solution in a .zip file, short of rewriting[/color][/color]
                > code[color=green][color=darkred]
                > > > from
                > > > > > scratch on this matter, which, as I said, will negate the[/color][/color][/color]
                usefulness[color=blue][color=green]
                > > of[color=darkred]
                > > > > this
                > > > > > group.
                > > > > >
                > > > > > Seems I have no choice, which is fine. Nobody owes me anything.
                > > > > >
                > > > > > Thanks again for the willingness to try to help. Please put your[/color][/color]
                > tired[color=green][color=darkred]
                > > > > self
                > > > > > to rest.
                > > > > >
                > > > > > Jon
                > > > > >
                > > > > >
                > > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                > > > > > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..
                > > > > > > Jon, it took me about half an hour to hand-pick the relevant[/color][/color][/color]
                lines[color=blue][color=green]
                > > of[color=darkred]
                > > > > code
                > > > > > > that would be useful to you. You are insistent on not visually
                > > > > evaluating
                > > > > > > what I wrote, which is your prerogative.
                > > > > > >
                > > > > > > Developing sample code that reproduces the problem is only[/color][/color]
                > possible[color=green]
                > > if[color=darkred]
                > > > > you
                > > > > > > know how to reproduce the problem, and I don't know how to[/color][/color]
                > reproduce[color=green][color=darkred]
                > > > the
                > > > > > > problem. Obviously if someone in this group cannot help me drill[/color]
                > > down[color=darkred]
                > > > to
                > > > > > the
                > > > > > > problem with the information I provided and without a full
                > > > reproduction,
                > > > > > > then, in order to provide a reproduction of the problem, I will[/color][/color]
                > have[color=green][color=darkred]
                > > > to
                > > > > > > rewrite from the ground up, adding line by line what I've done,[/color]
                > > until[color=darkred]
                > > > I
                > > > > > > discover the culprit (hence, I find what makes it[/color][/color][/color]
                reproduceable).[color=blue][color=green]
                > > But[color=darkred]
                > > > > that
                > > > > > > will take days, and by the time I find the culprit I won't need[/color][/color]
                > this[color=green][color=darkred]
                > > > > > > newsgroup.
                > > > > > >
                > > > > > > Thanks anyway.
                > > > > > >
                > > > > > > Jon
                > > > > > >
                > > > > > >
                > > > > > > "Jon Skeet" <skeet@pobox.co m> wrote in message
                > > > > > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...
                > > > > > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
                > > > > > > > > > But there was - if you'd posted a short but complete[/color][/color][/color]
                example[color=blue][color=green][color=darkred]
                > > > which
                > > > > > > > > > *wasn't* working on your box,
                > > > > > > > >
                > > > > > > > > But see I couldn't do that without giving you everything.
                > > > > > > >
                > > > > > > > But you could. You could have reduced the code gradually (a[/color][/color][/color]
                copy[color=blue][color=green]
                > > of[color=darkred]
                > > > > the
                > > > > > > > code, rather) until it worked. That would actually have shown[/color][/color]
                > you[color=green][color=darkred]
                > > > the
                > > > > > > > error very quickly (see below) due to what the problem turned[/color][/color]
                > out[color=green]
                > > to[color=darkred]
                > > > > > > > be. If the problem *had* been in the code, however, you would[/color][/color]
                > then[color=green][color=darkred]
                > > > > have
                > > > > > > > found it when it went from "not working" to "working". Either[/color][/color]
                > way,[color=green][color=darkred]
                > > > > > > > you'd have found the problem in the end.
                > > > > > > >
                > > > > > > > > There was absolutely no way to help you help me by[/color][/color][/color]
                reproducing[color=blue][color=green][color=darkred]
                > > > > sample
                > > > > > > code
                > > > > > > > > in new project code because I wouldn't have repeated the[/color][/color][/color]
                same[color=blue][color=green][color=darkred]
                > > > error
                > > > > > > (unless
                > > > > > > > > per chance I actually caught myself along the way).
                > > > > > > >
                > > > > > > > Which you should have done, because immediately after copying[/color][/color]
                > the[color=green][color=darkred]
                > > > full
                > > > > > > > code, the first thing to do would be to test that it still[/color][/color]
                > didn't[color=green][color=darkred]
                > > > > work.
                > > > > > > >
                > > > > > > > > Thanks again for your insightful question (re your previous[/color]
                > > post,[color=darkred]
                > > > > > > "Release
                > > > > > > > > mode"), it actually really helped me drill down to the[/color][/color]
                > problem,[color=green][color=darkred]
                > > > and
                > > > > > > frankly
                > > > > > > > > I don't know how else I would have found my error.
                > > > > > > >
                > > > > > > > See above.
                > > > > > > >
                > > > > > > > --
                > > > > > > > Jon Skeet - <skeet@pobox.co m>
                > > > > > > > http://www.pobox.com/~skeet/
                > > > > > > > If replying to the group, please do not mail me too
                > > > > > >
                > > > > > >
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Jon Skeet

                  #23
                  Re: Problem with virtual method

                  Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:[color=blue]
                  > From what I could tell, one of two things happened, both of which, I
                  > suppose, is a "framework flaw by design"--that is, my own error because of
                  > some things I didn't know to look for:
                  >
                  > 1. The child type was null:
                  > BaseObject obj =
                  > Activator.Creat eInstance(loade dAssemblies.get ChildType()); //
                  > returned null
                  > obj.VirtualMeth od(); // executed method from base object because obj is
                  > null[/color]

                  No - Activator.Creat eInstance throws an exception if the parameter is
                  null, and obj.VirtualMeth od() would throw an exception if obj were
                  null.
                  [color=blue]
                  > 2. The DLL was locked by Visual Studio .NET because it was open in my
                  > solution:
                  > BaseObject obj =
                  > Activator.Creat eInstance(loade dAssemblies.get ChildType()); //
                  > returned a Type, but assembly was locked
                  > obj.VirtualMeth od(); // executed method from base object because DLL
                  > from obj is locked[/color]

                  I would have thought it would be more likely that it was using an old
                  version of the DLL, which didn't override the method. Assemblies being
                  "in use" when they don't need to be is a problem various people have
                  reported with VS.NET though.

                  It sounds like it's the recompiling which was the issue - so if you'd
                  tried following my advice (first copying the solution) you would have
                  seen very quickly that it wasn't the code which was at fault, and could
                  have proceeded from there. Not that you're reading this, in all
                  probability.

                  --
                  Jon Skeet - <skeet@pobox.co m>
                  Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

                  If replying to the group, please do not mail me too

                  Comment

                  • Jon Davis

                    #24
                    Re: Problem with virtual method

                    Yes, the code is basically unchanged; the things that I changed have been
                    reverted and all is working fine. The problem is that the assemblies were
                    not loading correctly. This is definitely a bug in one of Microsoft's
                    tools--the base class should not have executed upon calling the method of a
                    child class in an invalid / improperly loaded assembly, rather an execution
                    engine error should have occurred.

                    An unidentified, inexplicable execution error *did* occur, however, a few
                    days ago when I tried calling the method manually from the Type object. That
                    was certainly better than executing the base object.

                    Jon



                    "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                    news:uV7EplOUDH A.1364@TK2MSFTN GP10.phx.gbl...[color=blue]
                    > Okay, making it abstract did help me identify that this was an assembly
                    > loading problem. I have fixed the assembly loading problem and the problem
                    > is resolved--the child class is FINALLY being executed, even after[/color]
                    reverting[color=blue]
                    > back to virtual (YAAAAY!!).
                    >
                    > I still perceive this to be a flaw in the Framework. There should have[/color]
                    been[color=blue]
                    > an error output indicating that the assembly did not load correctly. QUITE
                    > UNACCEPTABLE, Microsoft. I wasted at least two weeks on this.
                    >
                    > Jon
                    >
                    >
                    > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                    > news:%23PJAFROU DHA.304@tk2msft ngp13.phx.gbl.. .[color=green]
                    > > QUESTION: What on EARTH would disable the virtualness of a virtual[/color][/color]
                    method[color=blue][color=green]
                    > > except something (??) among the few lines of code that I posted?
                    > >
                    > > There is NO WAY that the other code, the business rules, which has[/color][/color]
                    NOTHING[color=blue][color=green]
                    > > to do with virtualness of the method, has anything to do with this[/color]
                    > problem.[color=green]
                    > > This IS a bug in the Framework.
                    > >
                    > > I have decided to make the method abstract.
                    > >
                    > > Jon
                    > >
                    > >
                    > > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@ema il.msn.com> wrote in[/color]
                    > message[color=green]
                    > > news:ughBIWtTDH A.560@TK2MSFTNG P10.phx.gbl...[color=darkred]
                    > > > Jon,
                    > > > Go the other direction!
                    > > >
                    > > > Start a new solution with two projects. The first project loads the[/color][/color]
                    > second[color=green][color=darkred]
                    > > > project and calls the virtual method. Include the minimalist amount of[/color]
                    > > code[color=darkred]
                    > > > to demonstrate the feature. Does it work?
                    > > >
                    > > > Start adding features from your larger project, until this new project
                    > > > fails. Baby steps! Add things one at a time. Hopefully when you added[/color][/color][/color]
                    X,[color=blue][color=green]
                    > > it[color=darkred]
                    > > > fails, then you know to look at X in the larger project.
                    > > >
                    > > > This helps solves two problems.
                    > > > 1. It gives you a reference point to compare to the larger project.
                    > > > 2. It proves what you are attempting to do works, or doesn't work.[/color][/color]
                    > Without[color=green][color=darkred]
                    > > > being bothered by the shear volume of the rest of your main project.
                    > > >
                    > > > 3. It also provides a small project that fails, which is what Jon[/color][/color][/color]
                    Skeet[color=blue][color=green]
                    > > was[color=darkred]
                    > > > asking for.
                    > > >
                    > > > Hope this helps
                    > > > Jay
                    > > >
                    > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                    > > > news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...
                    > > > > I should point out that my project is not currently open source and[/color][/color][/color]
                    as[color=blue][color=green][color=darkred]
                    > > > such
                    > > > > it is private. I am not going to post the entire project nor link to[/color][/color]
                    > it,[color=green][color=darkred]
                    > > > it
                    > > > > would be a waste of your time anyway (Mr. Skeet).
                    > > > >
                    > > > > I should also point out that I cannot simply remove code until the[/color]
                    > > problem[color=darkred]
                    > > > > fixes itself.
                    > > > >
                    > > > > 1. I don't know what to delete.
                    > > > > 2. If I do delete anything, it will break the entire project.
                    > > > > 3. I cannot simply paste the code into a new project because there[/color][/color]
                    > are[color=green][color=darkred]
                    > > > far
                    > > > > too many interdependent classes and types and methods, etc.
                    > > > >
                    > > > > Finally, I should point out that, while we must try to be respectful[/color][/color]
                    > to[color=green][color=darkred]
                    > > > > those who help, those who help should be respectful of these (above)
                    > > > > hindrances. I've done the best I can to provide what I know without
                    > > > posting
                    > > > > a link to the entire solution in a .zip file, short of rewriting[/color][/color][/color]
                    code[color=blue][color=green]
                    > > from[color=darkred]
                    > > > > scratch on this matter, which, as I said, will negate the usefulness[/color][/color][/color]
                    [color=blue]
                    > of[color=green][color=darkred]
                    > > > this
                    > > > > group.
                    > > > >
                    > > > > Seems I have no choice, which is fine. Nobody owes me anything.
                    > > > >
                    > > > > Thanks again for the willingness to try to help. Please put your[/color][/color][/color]
                    tired[color=blue][color=green][color=darkred]
                    > > > self
                    > > > > to rest.
                    > > > >
                    > > > > Jon
                    > > > >
                    > > > >
                    > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                    > > > > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..
                    > > > > > Jon, it took me about half an hour to hand-pick the relevant lines[/color][/color]
                    > of[color=green][color=darkred]
                    > > > code
                    > > > > > that would be useful to you. You are insistent on not visually
                    > > > evaluating
                    > > > > > what I wrote, which is your prerogative.
                    > > > > >
                    > > > > > Developing sample code that reproduces the problem is only[/color][/color][/color]
                    possible[color=blue]
                    > if[color=green][color=darkred]
                    > > > you
                    > > > > > know how to reproduce the problem, and I don't know how to[/color][/color][/color]
                    reproduce[color=blue][color=green]
                    > > the[color=darkred]
                    > > > > > problem. Obviously if someone in this group cannot help me drill[/color][/color]
                    > down[color=green]
                    > > to[color=darkred]
                    > > > > the
                    > > > > > problem with the information I provided and without a full[/color]
                    > > reproduction,[color=darkred]
                    > > > > > then, in order to provide a reproduction of the problem, I will[/color][/color][/color]
                    have[color=blue][color=green]
                    > > to[color=darkred]
                    > > > > > rewrite from the ground up, adding line by line what I've done,[/color][/color]
                    > until[color=green]
                    > > I[color=darkred]
                    > > > > > discover the culprit (hence, I find what makes it reproduceable).[/color][/color]
                    > But[color=green][color=darkred]
                    > > > that
                    > > > > > will take days, and by the time I find the culprit I won't need[/color][/color][/color]
                    this[color=blue][color=green][color=darkred]
                    > > > > > newsgroup.
                    > > > > >
                    > > > > > Thanks anyway.
                    > > > > >
                    > > > > > Jon
                    > > > > >
                    > > > > >
                    > > > > > "Jon Skeet" <skeet@pobox.co m> wrote in message
                    > > > > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...
                    > > > > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
                    > > > > > > > > But there was - if you'd posted a short but complete example[/color]
                    > > which[color=darkred]
                    > > > > > > > > *wasn't* working on your box,
                    > > > > > > >
                    > > > > > > > But see I couldn't do that without giving you everything.
                    > > > > > >
                    > > > > > > But you could. You could have reduced the code gradually (a copy[/color][/color]
                    > of[color=green][color=darkred]
                    > > > the
                    > > > > > > code, rather) until it worked. That would actually have shown[/color][/color][/color]
                    you[color=blue][color=green]
                    > > the[color=darkred]
                    > > > > > > error very quickly (see below) due to what the problem turned[/color][/color][/color]
                    out[color=blue]
                    > to[color=green][color=darkred]
                    > > > > > > be. If the problem *had* been in the code, however, you would[/color][/color][/color]
                    then[color=blue][color=green][color=darkred]
                    > > > have
                    > > > > > > found it when it went from "not working" to "working". Either[/color][/color][/color]
                    way,[color=blue][color=green][color=darkred]
                    > > > > > > you'd have found the problem in the end.
                    > > > > > >
                    > > > > > > > There was absolutely no way to help you help me by reproducing
                    > > > sample
                    > > > > > code
                    > > > > > > > in new project code because I wouldn't have repeated the same[/color]
                    > > error[color=darkred]
                    > > > > > (unless
                    > > > > > > > per chance I actually caught myself along the way).
                    > > > > > >
                    > > > > > > Which you should have done, because immediately after copying[/color][/color][/color]
                    the[color=blue][color=green]
                    > > full[color=darkred]
                    > > > > > > code, the first thing to do would be to test that it still[/color][/color][/color]
                    didn't[color=blue][color=green][color=darkred]
                    > > > work.
                    > > > > > >
                    > > > > > > > Thanks again for your insightful question (re your previous[/color][/color]
                    > post,[color=green][color=darkred]
                    > > > > > "Release
                    > > > > > > > mode"), it actually really helped me drill down to the[/color][/color][/color]
                    problem,[color=blue][color=green]
                    > > and[color=darkred]
                    > > > > > frankly
                    > > > > > > > I don't know how else I would have found my error.
                    > > > > > >
                    > > > > > > See above.
                    > > > > > >
                    > > > > > > --
                    > > > > > > Jon Skeet - <skeet@pobox.co m>
                    > > > > > > http://www.pobox.com/~skeet/
                    > > > > > > If replying to the group, please do not mail me too
                    > > > > >
                    > > > > >
                    > > > >
                    > > > >
                    > > >
                    > > >[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    • Jon Skeet

                      #25
                      Re: Problem with virtual method

                      Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:[color=blue]
                      > Yes, the code is basically unchanged; the things that I changed have been
                      > reverted and all is working fine. The problem is that the assemblies were
                      > not loading correctly. This is definitely a bug in one of Microsoft's
                      > tools--the base class should not have executed upon calling the method of a
                      > child class in an invalid / improperly loaded assembly, rather an execution
                      > engine error should have occurred.[/color]

                      Are you absolutely sure that it was the *loading* that was flawed
                      instead of the copying of the assembly in the first place? To me it
                      sounds more likely that you had an old copy of the assembly where
                      either the method wasn't virtual in the base class or wasn't overridden
                      in the derived class, and that copy was (possibly incorrectly) "in
                      use" so couldn't be overwritten.
                      [color=blue]
                      > An unidentified, inexplicable execution error *did* occur, however, a few
                      > days ago when I tried calling the method manually from the Type object. That
                      > was certainly better than executing the base object.[/color]

                      I'd be interested in knowing exactly what the situation was in that
                      case, and what the execution error was.

                      --
                      Jon Skeet - <skeet@pobox.co m>
                      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

                      If replying to the group, please do not mail me too

                      Comment

                      • Dave

                        #26
                        Re: Problem with virtual method

                        If you have a similar problem you can try running fuslogvw.exe. If your
                        problem is related to the runtime being unable to locate an assembly this
                        tool may help track down the problem.


                        "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                        news:ONZP1CQUDH A.1712@TK2MSFTN GP11.phx.gbl...[color=blue]
                        > It is possible that an obsolete DLL, wherein a child class did NOT[/color]
                        override[color=blue]
                        > the parent class's virtual method, was being loaded from an unexpected
                        > directory (my app does scan from more than one place). However, I cannot
                        > verify this; all files were deleted during the process of finding the
                        > solution.
                        >
                        > Jon
                        >
                        >
                        > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                        > news:Ofey1NPUDH A.560@TK2MSFTNG P10.phx.gbl...[color=green]
                        > > Yes, the code is basically unchanged; the things that I changed have[/color][/color]
                        been[color=blue][color=green]
                        > > reverted and all is working fine. The problem is that the assemblies[/color][/color]
                        were[color=blue][color=green]
                        > > not loading correctly. This is definitely a bug in one of Microsoft's
                        > > tools--the base class should not have executed upon calling the method[/color][/color]
                        of[color=blue]
                        > a[color=green]
                        > > child class in an invalid / improperly loaded assembly, rather an[/color]
                        > execution[color=green]
                        > > engine error should have occurred.
                        > >
                        > > An unidentified, inexplicable execution error *did* occur, however, a[/color][/color]
                        few[color=blue][color=green]
                        > > days ago when I tried calling the method manually from the Type object.[/color]
                        > That[color=green]
                        > > was certainly better than executing the base object.
                        > >
                        > > Jon
                        > >
                        > >
                        > >
                        > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                        > > news:uV7EplOUDH A.1364@TK2MSFTN GP10.phx.gbl...[color=darkred]
                        > > > Okay, making it abstract did help me identify that this was an[/color][/color][/color]
                        assembly[color=blue][color=green][color=darkred]
                        > > > loading problem. I have fixed the assembly loading problem and the[/color][/color]
                        > problem[color=green][color=darkred]
                        > > > is resolved--the child class is FINALLY being executed, even after[/color]
                        > > reverting[color=darkred]
                        > > > back to virtual (YAAAAY!!).
                        > > >
                        > > > I still perceive this to be a flaw in the Framework. There should have[/color]
                        > > been[color=darkred]
                        > > > an error output indicating that the assembly did not load correctly.[/color][/color]
                        > QUITE[color=green][color=darkred]
                        > > > UNACCEPTABLE, Microsoft. I wasted at least two weeks on this.
                        > > >
                        > > > Jon
                        > > >
                        > > >
                        > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                        > > > news:%23PJAFROU DHA.304@tk2msft ngp13.phx.gbl.. .
                        > > > > QUESTION: What on EARTH would disable the virtualness of a virtual[/color]
                        > > method[color=darkred]
                        > > > > except something (??) among the few lines of code that I posted?
                        > > > >
                        > > > > There is NO WAY that the other code, the business rules, which has[/color]
                        > > NOTHING[color=darkred]
                        > > > > to do with virtualness of the method, has anything to do with this
                        > > > problem.
                        > > > > This IS a bug in the Framework.
                        > > > >
                        > > > > I have decided to make the method abstract.
                        > > > >
                        > > > > Jon
                        > > > >
                        > > > >
                        > > > > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@ema il.msn.com> wrote in
                        > > > message
                        > > > > news:ughBIWtTDH A.560@TK2MSFTNG P10.phx.gbl...
                        > > > > > Jon,
                        > > > > > Go the other direction!
                        > > > > >
                        > > > > > Start a new solution with two projects. The first project loads[/color][/color][/color]
                        the[color=blue][color=green][color=darkred]
                        > > > second
                        > > > > > project and calls the virtual method. Include the minimalist[/color][/color][/color]
                        amount[color=blue]
                        > of[color=green][color=darkred]
                        > > > > code
                        > > > > > to demonstrate the feature. Does it work?
                        > > > > >
                        > > > > > Start adding features from your larger project, until this new[/color][/color]
                        > project[color=green][color=darkred]
                        > > > > > fails. Baby steps! Add things one at a time. Hopefully when you[/color][/color]
                        > added[color=green]
                        > > X,[color=darkred]
                        > > > > it
                        > > > > > fails, then you know to look at X in the larger project.
                        > > > > >
                        > > > > > This helps solves two problems.
                        > > > > > 1. It gives you a reference point to compare to the larger[/color][/color][/color]
                        project.[color=blue][color=green][color=darkred]
                        > > > > > 2. It proves what you are attempting to do works, or doesn't work.
                        > > > Without
                        > > > > > being bothered by the shear volume of the rest of your main[/color][/color][/color]
                        project.[color=blue][color=green][color=darkred]
                        > > > > >
                        > > > > > 3. It also provides a small project that fails, which is what Jon[/color]
                        > > Skeet[color=darkred]
                        > > > > was
                        > > > > > asking for.
                        > > > > >
                        > > > > > Hope this helps
                        > > > > > Jay
                        > > > > >
                        > > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                        > > > > > news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...
                        > > > > > > I should point out that my project is not currently open source[/color][/color]
                        > and[color=green]
                        > > as[color=darkred]
                        > > > > > such
                        > > > > > > it is private. I am not going to post the entire project nor[/color][/color][/color]
                        link[color=blue]
                        > to[color=green][color=darkred]
                        > > > it,
                        > > > > > it
                        > > > > > > would be a waste of your time anyway (Mr. Skeet).
                        > > > > > >
                        > > > > > > I should also point out that I cannot simply remove code until[/color][/color][/color]
                        the[color=blue][color=green][color=darkred]
                        > > > > problem
                        > > > > > > fixes itself.
                        > > > > > >
                        > > > > > > 1. I don't know what to delete.
                        > > > > > > 2. If I do delete anything, it will break the entire project.
                        > > > > > > 3. I cannot simply paste the code into a new project because[/color][/color]
                        > there[color=green][color=darkred]
                        > > > are
                        > > > > > far
                        > > > > > > too many interdependent classes and types and methods, etc.
                        > > > > > >
                        > > > > > > Finally, I should point out that, while we must try to be[/color][/color]
                        > respectful[color=green][color=darkred]
                        > > > to
                        > > > > > > those who help, those who help should be respectful of these[/color][/color]
                        > (above)[color=green][color=darkred]
                        > > > > > > hindrances. I've done the best I can to provide what I know[/color][/color]
                        > without[color=green][color=darkred]
                        > > > > > posting
                        > > > > > > a link to the entire solution in a .zip file, short of rewriting[/color]
                        > > code[color=darkred]
                        > > > > from
                        > > > > > > scratch on this matter, which, as I said, will negate the[/color][/color]
                        > usefulness[color=green]
                        > >[color=darkred]
                        > > > of
                        > > > > > this
                        > > > > > > group.
                        > > > > > >
                        > > > > > > Seems I have no choice, which is fine. Nobody owes me anything.
                        > > > > > >
                        > > > > > > Thanks again for the willingness to try to help. Please put your[/color]
                        > > tired[color=darkred]
                        > > > > > self
                        > > > > > > to rest.
                        > > > > > >
                        > > > > > > Jon
                        > > > > > >
                        > > > > > >
                        > > > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                        > > > > > > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..
                        > > > > > > > Jon, it took me about half an hour to hand-pick the relevant[/color][/color]
                        > lines[color=green][color=darkred]
                        > > > of
                        > > > > > code
                        > > > > > > > that would be useful to you. You are insistent on not visually
                        > > > > > evaluating
                        > > > > > > > what I wrote, which is your prerogative.
                        > > > > > > >
                        > > > > > > > Developing sample code that reproduces the problem is only[/color]
                        > > possible[color=darkred]
                        > > > if
                        > > > > > you
                        > > > > > > > know how to reproduce the problem, and I don't know how to[/color]
                        > > reproduce[color=darkred]
                        > > > > the
                        > > > > > > > problem. Obviously if someone in this group cannot help me[/color][/color][/color]
                        drill[color=blue][color=green][color=darkred]
                        > > > down
                        > > > > to
                        > > > > > > the
                        > > > > > > > problem with the information I provided and without a full
                        > > > > reproduction,
                        > > > > > > > then, in order to provide a reproduction of the problem, I[/color][/color][/color]
                        will[color=blue][color=green]
                        > > have[color=darkred]
                        > > > > to
                        > > > > > > > rewrite from the ground up, adding line by line what I've[/color][/color][/color]
                        done,[color=blue][color=green][color=darkred]
                        > > > until
                        > > > > I
                        > > > > > > > discover the culprit (hence, I find what makes it[/color][/color]
                        > reproduceable).[color=green][color=darkred]
                        > > > But
                        > > > > > that
                        > > > > > > > will take days, and by the time I find the culprit I won't[/color][/color][/color]
                        need[color=blue][color=green]
                        > > this[color=darkred]
                        > > > > > > > newsgroup.
                        > > > > > > >
                        > > > > > > > Thanks anyway.
                        > > > > > > >
                        > > > > > > > Jon
                        > > > > > > >
                        > > > > > > >
                        > > > > > > > "Jon Skeet" <skeet@pobox.co m> wrote in message
                        > > > > > > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...
                        > > > > > > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
                        > > > > > > > > > > But there was - if you'd posted a short but complete[/color][/color]
                        > example[color=green][color=darkred]
                        > > > > which
                        > > > > > > > > > > *wasn't* working on your box,
                        > > > > > > > > >
                        > > > > > > > > > But see I couldn't do that without giving you everything.
                        > > > > > > > >
                        > > > > > > > > But you could. You could have reduced the code gradually (a[/color][/color]
                        > copy[color=green][color=darkred]
                        > > > of
                        > > > > > the
                        > > > > > > > > code, rather) until it worked. That would actually have[/color][/color][/color]
                        shown[color=blue][color=green]
                        > > you[color=darkred]
                        > > > > the
                        > > > > > > > > error very quickly (see below) due to what the problem[/color][/color][/color]
                        turned[color=blue][color=green]
                        > > out[color=darkred]
                        > > > to
                        > > > > > > > > be. If the problem *had* been in the code, however, you[/color][/color][/color]
                        would[color=blue][color=green]
                        > > then[color=darkred]
                        > > > > > have
                        > > > > > > > > found it when it went from "not working" to "working".[/color][/color][/color]
                        Either[color=blue][color=green]
                        > > way,[color=darkred]
                        > > > > > > > > you'd have found the problem in the end.
                        > > > > > > > >
                        > > > > > > > > > There was absolutely no way to help you help me by[/color][/color]
                        > reproducing[color=green][color=darkred]
                        > > > > > sample
                        > > > > > > > code
                        > > > > > > > > > in new project code because I wouldn't have repeated the[/color][/color]
                        > same[color=green][color=darkred]
                        > > > > error
                        > > > > > > > (unless
                        > > > > > > > > > per chance I actually caught myself along the way).
                        > > > > > > > >
                        > > > > > > > > Which you should have done, because immediately after[/color][/color][/color]
                        copying[color=blue][color=green]
                        > > the[color=darkred]
                        > > > > full
                        > > > > > > > > code, the first thing to do would be to test that it still[/color]
                        > > didn't[color=darkred]
                        > > > > > work.
                        > > > > > > > >
                        > > > > > > > > > Thanks again for your insightful question (re your[/color][/color][/color]
                        previous[color=blue][color=green][color=darkred]
                        > > > post,
                        > > > > > > > "Release
                        > > > > > > > > > mode"), it actually really helped me drill down to the[/color]
                        > > problem,[color=darkred]
                        > > > > and
                        > > > > > > > frankly
                        > > > > > > > > > I don't know how else I would have found my error.
                        > > > > > > > >
                        > > > > > > > > See above.
                        > > > > > > > >
                        > > > > > > > > --
                        > > > > > > > > Jon Skeet - <skeet@pobox.co m>
                        > > > > > > > > http://www.pobox.com/~skeet/
                        > > > > > > > > If replying to the group, please do not mail me too
                        > > > > > > >
                        > > > > > > >
                        > > > > > >
                        > > > > > >
                        > > > > >
                        > > > > >
                        > > > >
                        > > > >
                        > > >
                        > > >[/color]
                        > >
                        > >[/color]
                        >
                        >[/color]


                        Comment

                        • Jon Davis

                          #27
                          Re: Problem with virtual method

                          Ah but it did load an assembly and the assembly's class did inherit my base
                          object and it recognized my type and loaded it as such, it was just
                          executing the base instance of a virtual method, so I didn't know whether
                          this was an assembly loading problem ..

                          I really don't know what happened, but I do know that if it loaded an
                          obsolete assembly--something I feared for days, but didn't bother to look
                          further into it until the problem was found--then that would make a lot of
                          sense and explain the problem: the obsolete assembly's child class didn't
                          override the virtual method.

                          What a nrrrrrd I am ....

                          Jon


                          "Dave" <kdlevine@wi.rr .com> wrote in message
                          news:OYcMJIQUDH A.1712@tk2msftn gp13.phx.gbl...[color=blue]
                          > If you have a similar problem you can try running fuslogvw.exe. If your
                          > problem is related to the runtime being unable to locate an assembly this
                          > tool may help track down the problem.
                          >
                          >
                          > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                          > news:ONZP1CQUDH A.1712@TK2MSFTN GP11.phx.gbl...[color=green]
                          > > It is possible that an obsolete DLL, wherein a child class did NOT[/color]
                          > override[color=green]
                          > > the parent class's virtual method, was being loaded from an unexpected
                          > > directory (my app does scan from more than one place). However, I cannot
                          > > verify this; all files were deleted during the process of finding the
                          > > solution.
                          > >
                          > > Jon
                          > >
                          > >
                          > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                          > > news:Ofey1NPUDH A.560@TK2MSFTNG P10.phx.gbl...[color=darkred]
                          > > > Yes, the code is basically unchanged; the things that I changed have[/color][/color]
                          > been[color=green][color=darkred]
                          > > > reverted and all is working fine. The problem is that the assemblies[/color][/color]
                          > were[color=green][color=darkred]
                          > > > not loading correctly. This is definitely a bug in one of Microsoft's
                          > > > tools--the base class should not have executed upon calling the method[/color][/color]
                          > of[color=green]
                          > > a[color=darkred]
                          > > > child class in an invalid / improperly loaded assembly, rather an[/color]
                          > > execution[color=darkred]
                          > > > engine error should have occurred.
                          > > >
                          > > > An unidentified, inexplicable execution error *did* occur, however, a[/color][/color]
                          > few[color=green][color=darkred]
                          > > > days ago when I tried calling the method manually from the Type[/color][/color][/color]
                          object.[color=blue][color=green]
                          > > That[color=darkred]
                          > > > was certainly better than executing the base object.
                          > > >
                          > > > Jon
                          > > >
                          > > >
                          > > >
                          > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                          > > > news:uV7EplOUDH A.1364@TK2MSFTN GP10.phx.gbl...
                          > > > > Okay, making it abstract did help me identify that this was an[/color][/color]
                          > assembly[color=green][color=darkred]
                          > > > > loading problem. I have fixed the assembly loading problem and the[/color]
                          > > problem[color=darkred]
                          > > > > is resolved--the child class is FINALLY being executed, even after
                          > > > reverting
                          > > > > back to virtual (YAAAAY!!).
                          > > > >
                          > > > > I still perceive this to be a flaw in the Framework. There should[/color][/color][/color]
                          have[color=blue][color=green][color=darkred]
                          > > > been
                          > > > > an error output indicating that the assembly did not load correctly.[/color]
                          > > QUITE[color=darkred]
                          > > > > UNACCEPTABLE, Microsoft. I wasted at least two weeks on this.
                          > > > >
                          > > > > Jon
                          > > > >
                          > > > >
                          > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                          > > > > news:%23PJAFROU DHA.304@tk2msft ngp13.phx.gbl.. .
                          > > > > > QUESTION: What on EARTH would disable the virtualness of a virtual
                          > > > method
                          > > > > > except something (??) among the few lines of code that I posted?
                          > > > > >
                          > > > > > There is NO WAY that the other code, the business rules, which has
                          > > > NOTHING
                          > > > > > to do with virtualness of the method, has anything to do with this
                          > > > > problem.
                          > > > > > This IS a bug in the Framework.
                          > > > > >
                          > > > > > I have decided to make the method abstract.
                          > > > > >
                          > > > > > Jon
                          > > > > >
                          > > > > >
                          > > > > > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@ema il.msn.com> wrote[/color][/color][/color]
                          in[color=blue][color=green][color=darkred]
                          > > > > message
                          > > > > > news:ughBIWtTDH A.560@TK2MSFTNG P10.phx.gbl...
                          > > > > > > Jon,
                          > > > > > > Go the other direction!
                          > > > > > >
                          > > > > > > Start a new solution with two projects. The first project loads[/color][/color]
                          > the[color=green][color=darkred]
                          > > > > second
                          > > > > > > project and calls the virtual method. Include the minimalist[/color][/color]
                          > amount[color=green]
                          > > of[color=darkred]
                          > > > > > code
                          > > > > > > to demonstrate the feature. Does it work?
                          > > > > > >
                          > > > > > > Start adding features from your larger project, until this new[/color]
                          > > project[color=darkred]
                          > > > > > > fails. Baby steps! Add things one at a time. Hopefully when you[/color]
                          > > added[color=darkred]
                          > > > X,
                          > > > > > it
                          > > > > > > fails, then you know to look at X in the larger project.
                          > > > > > >
                          > > > > > > This helps solves two problems.
                          > > > > > > 1. It gives you a reference point to compare to the larger[/color][/color]
                          > project.[color=green][color=darkred]
                          > > > > > > 2. It proves what you are attempting to do works, or doesn't[/color][/color][/color]
                          work.[color=blue][color=green][color=darkred]
                          > > > > Without
                          > > > > > > being bothered by the shear volume of the rest of your main[/color][/color]
                          > project.[color=green][color=darkred]
                          > > > > > >
                          > > > > > > 3. It also provides a small project that fails, which is what[/color][/color][/color]
                          Jon[color=blue][color=green][color=darkred]
                          > > > Skeet
                          > > > > > was
                          > > > > > > asking for.
                          > > > > > >
                          > > > > > > Hope this helps
                          > > > > > > Jay
                          > > > > > >
                          > > > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                          > > > > > > news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...
                          > > > > > > > I should point out that my project is not currently open[/color][/color][/color]
                          source[color=blue][color=green]
                          > > and[color=darkred]
                          > > > as
                          > > > > > > such
                          > > > > > > > it is private. I am not going to post the entire project nor[/color][/color]
                          > link[color=green]
                          > > to[color=darkred]
                          > > > > it,
                          > > > > > > it
                          > > > > > > > would be a waste of your time anyway (Mr. Skeet).
                          > > > > > > >
                          > > > > > > > I should also point out that I cannot simply remove code until[/color][/color]
                          > the[color=green][color=darkred]
                          > > > > > problem
                          > > > > > > > fixes itself.
                          > > > > > > >
                          > > > > > > > 1. I don't know what to delete.
                          > > > > > > > 2. If I do delete anything, it will break the entire[/color][/color][/color]
                          project.[color=blue][color=green][color=darkred]
                          > > > > > > > 3. I cannot simply paste the code into a new project because[/color]
                          > > there[color=darkred]
                          > > > > are
                          > > > > > > far
                          > > > > > > > too many interdependent classes and types and methods, etc.
                          > > > > > > >
                          > > > > > > > Finally, I should point out that, while we must try to be[/color]
                          > > respectful[color=darkred]
                          > > > > to
                          > > > > > > > those who help, those who help should be respectful of these[/color]
                          > > (above)[color=darkred]
                          > > > > > > > hindrances. I've done the best I can to provide what I know[/color]
                          > > without[color=darkred]
                          > > > > > > posting
                          > > > > > > > a link to the entire solution in a .zip file, short of[/color][/color][/color]
                          rewriting[color=blue][color=green][color=darkred]
                          > > > code
                          > > > > > from
                          > > > > > > > scratch on this matter, which, as I said, will negate the[/color]
                          > > usefulness[color=darkred]
                          > > >
                          > > > > of
                          > > > > > > this
                          > > > > > > > group.
                          > > > > > > >
                          > > > > > > > Seems I have no choice, which is fine. Nobody owes me[/color][/color][/color]
                          anything.[color=blue][color=green][color=darkred]
                          > > > > > > >
                          > > > > > > > Thanks again for the willingness to try to help. Please put[/color][/color][/color]
                          your[color=blue][color=green][color=darkred]
                          > > > tired
                          > > > > > > self
                          > > > > > > > to rest.
                          > > > > > > >
                          > > > > > > > Jon
                          > > > > > > >
                          > > > > > > >
                          > > > > > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in[/color][/color][/color]
                          message[color=blue][color=green][color=darkred]
                          > > > > > > > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..
                          > > > > > > > > Jon, it took me about half an hour to hand-pick the relevant[/color]
                          > > lines[color=darkred]
                          > > > > of
                          > > > > > > code
                          > > > > > > > > that would be useful to you. You are insistent on not[/color][/color][/color]
                          visually[color=blue][color=green][color=darkred]
                          > > > > > > evaluating
                          > > > > > > > > what I wrote, which is your prerogative.
                          > > > > > > > >
                          > > > > > > > > Developing sample code that reproduces the problem is only
                          > > > possible
                          > > > > if
                          > > > > > > you
                          > > > > > > > > know how to reproduce the problem, and I don't know how to
                          > > > reproduce
                          > > > > > the
                          > > > > > > > > problem. Obviously if someone in this group cannot help me[/color][/color]
                          > drill[color=green][color=darkred]
                          > > > > down
                          > > > > > to
                          > > > > > > > the
                          > > > > > > > > problem with the information I provided and without a full
                          > > > > > reproduction,
                          > > > > > > > > then, in order to provide a reproduction of the problem, I[/color][/color]
                          > will[color=green][color=darkred]
                          > > > have
                          > > > > > to
                          > > > > > > > > rewrite from the ground up, adding line by line what I've[/color][/color]
                          > done,[color=green][color=darkred]
                          > > > > until
                          > > > > > I
                          > > > > > > > > discover the culprit (hence, I find what makes it[/color]
                          > > reproduceable).[color=darkred]
                          > > > > But
                          > > > > > > that
                          > > > > > > > > will take days, and by the time I find the culprit I won't[/color][/color]
                          > need[color=green][color=darkred]
                          > > > this
                          > > > > > > > > newsgroup.
                          > > > > > > > >
                          > > > > > > > > Thanks anyway.
                          > > > > > > > >
                          > > > > > > > > Jon
                          > > > > > > > >
                          > > > > > > > >
                          > > > > > > > > "Jon Skeet" <skeet@pobox.co m> wrote in message
                          > > > > > > > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...
                          > > > > > > > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
                          > > > > > > > > > > > But there was - if you'd posted a short but complete[/color]
                          > > example[color=darkred]
                          > > > > > which
                          > > > > > > > > > > > *wasn't* working on your box,
                          > > > > > > > > > >
                          > > > > > > > > > > But see I couldn't do that without giving you[/color][/color][/color]
                          everything.[color=blue][color=green][color=darkred]
                          > > > > > > > > >
                          > > > > > > > > > But you could. You could have reduced the code gradually[/color][/color][/color]
                          (a[color=blue][color=green]
                          > > copy[color=darkred]
                          > > > > of
                          > > > > > > the
                          > > > > > > > > > code, rather) until it worked. That would actually have[/color][/color]
                          > shown[color=green][color=darkred]
                          > > > you
                          > > > > > the
                          > > > > > > > > > error very quickly (see below) due to what the problem[/color][/color]
                          > turned[color=green][color=darkred]
                          > > > out
                          > > > > to
                          > > > > > > > > > be. If the problem *had* been in the code, however, you[/color][/color]
                          > would[color=green][color=darkred]
                          > > > then
                          > > > > > > have
                          > > > > > > > > > found it when it went from "not working" to "working".[/color][/color]
                          > Either[color=green][color=darkred]
                          > > > way,
                          > > > > > > > > > you'd have found the problem in the end.
                          > > > > > > > > >
                          > > > > > > > > > > There was absolutely no way to help you help me by[/color]
                          > > reproducing[color=darkred]
                          > > > > > > sample
                          > > > > > > > > code
                          > > > > > > > > > > in new project code because I wouldn't have repeated the[/color]
                          > > same[color=darkred]
                          > > > > > error
                          > > > > > > > > (unless
                          > > > > > > > > > > per chance I actually caught myself along the way).
                          > > > > > > > > >
                          > > > > > > > > > Which you should have done, because immediately after[/color][/color]
                          > copying[color=green][color=darkred]
                          > > > the
                          > > > > > full
                          > > > > > > > > > code, the first thing to do would be to test that it still
                          > > > didn't
                          > > > > > > work.
                          > > > > > > > > >
                          > > > > > > > > > > Thanks again for your insightful question (re your[/color][/color]
                          > previous[color=green][color=darkred]
                          > > > > post,
                          > > > > > > > > "Release
                          > > > > > > > > > > mode"), it actually really helped me drill down to the
                          > > > problem,
                          > > > > > and
                          > > > > > > > > frankly
                          > > > > > > > > > > I don't know how else I would have found my error.
                          > > > > > > > > >
                          > > > > > > > > > See above.
                          > > > > > > > > >
                          > > > > > > > > > --
                          > > > > > > > > > Jon Skeet - <skeet@pobox.co m>
                          > > > > > > > > > http://www.pobox.com/~skeet/
                          > > > > > > > > > If replying to the group, please do not mail me too
                          > > > > > > > >
                          > > > > > > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > >
                          > > > >
                          > > >
                          > > >[/color]
                          > >
                          > >[/color]
                          >
                          >[/color]


                          Comment

                          • Jay B. Harlow [MVP - Outlook]

                            #28
                            Re: Problem with virtual method

                            Jon,
                            That's a good question! I do what you are asking in 3 or 4 projects. I have
                            yet to see it fail.

                            Rather than loading the assembly, I normally use Type.GetType to load the
                            type & assembly at one time. This will either return my type or throw an
                            exception. I have yet to see it return null.

                            I then use Activator.Creat eInstance to create an instance, of the above
                            type.

                            For the Type.GetType method, I pass a string in the form
                            "mynamespace.my type, myassembly".

                            As you may have found there are at least three ways to dynamically create
                            objects in .NET.

                            Glad you got it to work!

                            Hope this helps
                            Jay

                            "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                            news:%23PJAFROU DHA.304@tk2msft ngp13.phx.gbl.. .[color=blue]
                            > QUESTION: What on EARTH would disable the virtualness of a virtual method
                            > except something (??) among the few lines of code that I posted?
                            >
                            > There is NO WAY that the other code, the business rules, which has NOTHING
                            > to do with virtualness of the method, has anything to do with this[/color]
                            problem.[color=blue]
                            > This IS a bug in the Framework.
                            >
                            > I have decided to make the method abstract.
                            >
                            > Jon
                            >
                            >
                            > "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow@ema il.msn.com> wrote in[/color]
                            message[color=blue]
                            > news:ughBIWtTDH A.560@TK2MSFTNG P10.phx.gbl...[color=green]
                            > > Jon,
                            > > Go the other direction!
                            > >
                            > > Start a new solution with two projects. The first project loads the[/color][/color]
                            second[color=blue][color=green]
                            > > project and calls the virtual method. Include the minimalist amount of[/color]
                            > code[color=green]
                            > > to demonstrate the feature. Does it work?
                            > >
                            > > Start adding features from your larger project, until this new project
                            > > fails. Baby steps! Add things one at a time. Hopefully when you added X,[/color]
                            > it[color=green]
                            > > fails, then you know to look at X in the larger project.
                            > >
                            > > This helps solves two problems.
                            > > 1. It gives you a reference point to compare to the larger project.
                            > > 2. It proves what you are attempting to do works, or doesn't work.[/color][/color]
                            Without[color=blue][color=green]
                            > > being bothered by the shear volume of the rest of your main project.
                            > >
                            > > 3. It also provides a small project that fails, which is what Jon Skeet[/color]
                            > was[color=green]
                            > > asking for.
                            > >
                            > > Hope this helps
                            > > Jay
                            > >
                            > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                            > > news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...[color=darkred]
                            > > > I should point out that my project is not currently open source and as[/color]
                            > > such[color=darkred]
                            > > > it is private. I am not going to post the entire project nor link to[/color][/color][/color]
                            it,[color=blue][color=green]
                            > > it[color=darkred]
                            > > > would be a waste of your time anyway (Mr. Skeet).
                            > > >
                            > > > I should also point out that I cannot simply remove code until the[/color][/color]
                            > problem[color=green][color=darkred]
                            > > > fixes itself.
                            > > >
                            > > > 1. I don't know what to delete.
                            > > > 2. If I do delete anything, it will break the entire project.
                            > > > 3. I cannot simply paste the code into a new project because there[/color][/color][/color]
                            are[color=blue][color=green]
                            > > far[color=darkred]
                            > > > too many interdependent classes and types and methods, etc.
                            > > >
                            > > > Finally, I should point out that, while we must try to be respectful[/color][/color][/color]
                            to[color=blue][color=green][color=darkred]
                            > > > those who help, those who help should be respectful of these (above)
                            > > > hindrances. I've done the best I can to provide what I know without[/color]
                            > > posting[color=darkred]
                            > > > a link to the entire solution in a .zip file, short of rewriting code[/color][/color]
                            > from[color=green][color=darkred]
                            > > > scratch on this matter, which, as I said, will negate the usefulness[/color][/color][/color]
                            of[color=blue][color=green]
                            > > this[color=darkred]
                            > > > group.
                            > > >
                            > > > Seems I have no choice, which is fine. Nobody owes me anything.
                            > > >
                            > > > Thanks again for the willingness to try to help. Please put your tired[/color]
                            > > self[color=darkred]
                            > > > to rest.
                            > > >
                            > > > Jon
                            > > >
                            > > >
                            > > > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote in message
                            > > > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..
                            > > > > Jon, it took me about half an hour to hand-pick the relevant lines[/color][/color][/color]
                            of[color=blue][color=green]
                            > > code[color=darkred]
                            > > > > that would be useful to you. You are insistent on not visually[/color]
                            > > evaluating[color=darkred]
                            > > > > what I wrote, which is your prerogative.
                            > > > >
                            > > > > Developing sample code that reproduces the problem is only possible[/color][/color][/color]
                            if[color=blue][color=green]
                            > > you[color=darkred]
                            > > > > know how to reproduce the problem, and I don't know how to reproduce[/color][/color]
                            > the[color=green][color=darkred]
                            > > > > problem. Obviously if someone in this group cannot help me drill[/color][/color][/color]
                            down[color=blue]
                            > to[color=green][color=darkred]
                            > > > the
                            > > > > problem with the information I provided and without a full[/color][/color]
                            > reproduction,[color=green][color=darkred]
                            > > > > then, in order to provide a reproduction of the problem, I will have[/color][/color]
                            > to[color=green][color=darkred]
                            > > > > rewrite from the ground up, adding line by line what I've done,[/color][/color][/color]
                            until[color=blue]
                            > I[color=green][color=darkred]
                            > > > > discover the culprit (hence, I find what makes it reproduceable).[/color][/color][/color]
                            But[color=blue][color=green]
                            > > that[color=darkred]
                            > > > > will take days, and by the time I find the culprit I won't need this
                            > > > > newsgroup.
                            > > > >
                            > > > > Thanks anyway.
                            > > > >
                            > > > > Jon
                            > > > >
                            > > > >
                            > > > > "Jon Skeet" <skeet@pobox.co m> wrote in message
                            > > > > news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...
                            > > > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net> wrote:
                            > > > > > > > But there was - if you'd posted a short but complete example[/color][/color]
                            > which[color=green][color=darkred]
                            > > > > > > > *wasn't* working on your box,
                            > > > > > >
                            > > > > > > But see I couldn't do that without giving you everything.
                            > > > > >
                            > > > > > But you could. You could have reduced the code gradually (a copy[/color][/color][/color]
                            of[color=blue][color=green]
                            > > the[color=darkred]
                            > > > > > code, rather) until it worked. That would actually have shown you[/color][/color]
                            > the[color=green][color=darkred]
                            > > > > > error very quickly (see below) due to what the problem turned out[/color][/color][/color]
                            to[color=blue][color=green][color=darkred]
                            > > > > > be. If the problem *had* been in the code, however, you would then[/color]
                            > > have[color=darkred]
                            > > > > > found it when it went from "not working" to "working". Either way,
                            > > > > > you'd have found the problem in the end.
                            > > > > >
                            > > > > > > There was absolutely no way to help you help me by reproducing[/color]
                            > > sample[color=darkred]
                            > > > > code
                            > > > > > > in new project code because I wouldn't have repeated the same[/color][/color]
                            > error[color=green][color=darkred]
                            > > > > (unless
                            > > > > > > per chance I actually caught myself along the way).
                            > > > > >
                            > > > > > Which you should have done, because immediately after copying the[/color][/color]
                            > full[color=green][color=darkred]
                            > > > > > code, the first thing to do would be to test that it still didn't[/color]
                            > > work.[color=darkred]
                            > > > > >
                            > > > > > > Thanks again for your insightful question (re your previous[/color][/color][/color]
                            post,[color=blue][color=green][color=darkred]
                            > > > > "Release
                            > > > > > > mode"), it actually really helped me drill down to the problem,[/color][/color]
                            > and[color=green][color=darkred]
                            > > > > frankly
                            > > > > > > I don't know how else I would have found my error.
                            > > > > >
                            > > > > > See above.
                            > > > > >
                            > > > > > --
                            > > > > > Jon Skeet - <skeet@pobox.co m>
                            > > > > > http://www.pobox.com/~skeet/
                            > > > > > If replying to the group, please do not mail me too
                            > > > >
                            > > > >
                            > > >
                            > > >[/color]
                            > >
                            > >[/color]
                            >
                            >[/color]


                            Comment

                            • Guest's Avatar

                              #29
                              Re: Problem with virtual method

                              [color=blue]
                              >-----Original Message-----
                              >Thanks for the feedback, Jay, I'll consider your advice.[/color]
                              And thanks for not[color=blue]
                              >beating me over the head like some other people have[/color]
                              done in the past for[color=blue]
                              >not doing things their way.
                              >
                              >Jon
                              >
                              >
                              >"Jay B. Harlow [MVP - Outlook]"[/color]
                              <Jay_Harlow@ema il.msn.com> wrote in message[color=blue]
                              >news:ughBIWtTD HA.560@TK2MSFTN GP10.phx.gbl...[color=green]
                              >> Jon,
                              >> Go the other direction!
                              >>
                              >> Start a new solution with two projects. The first[/color][/color]
                              project loads the second[color=blue][color=green]
                              >> project and calls the virtual method. Include the[/color][/color]
                              minimalist amount of[color=blue]
                              >code[color=green]
                              >> to demonstrate the feature. Does it work?
                              >>
                              >> Start adding features from your larger project, until[/color][/color]
                              this new project[color=blue][color=green]
                              >> fails. Baby steps! Add things one at a time. Hopefully[/color][/color]
                              when you added X,[color=blue]
                              >it[color=green]
                              >> fails, then you know to look at X in the larger[/color][/color]
                              project.[color=blue][color=green]
                              >>
                              >> This helps solves two problems.
                              >> 1. It gives you a reference point to compare to the[/color][/color]
                              larger project.[color=blue][color=green]
                              >> 2. It proves what you are attempting to do works, or[/color][/color]
                              doesn't work. Without[color=blue][color=green]
                              >> being bothered by the shear volume of the rest of your[/color][/color]
                              main project.[color=blue][color=green]
                              >>
                              >> 3. It also provides a small project that fails, which[/color][/color]
                              is what Jon Skeet[color=blue]
                              >was[color=green]
                              >> asking for.
                              >>
                              >> Hope this helps
                              >> Jay
                              >>
                              >> "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net> wrote[/color][/color]
                              in message[color=blue][color=green]
                              >> news:OtFKSHqTDH A.3192@tk2msftn gp13.phx.gbl...[color=darkred]
                              >> > I should point out that my project is not currently[/color][/color][/color]
                              open source and as[color=blue][color=green]
                              >> such[color=darkred]
                              >> > it is private. I am not going to post the entire[/color][/color][/color]
                              project nor link to it,[color=blue][color=green]
                              >> it[color=darkred]
                              >> > would be a waste of your time anyway (Mr. Skeet).
                              >> >
                              >> > I should also point out that I cannot simply remove[/color][/color][/color]
                              code until the[color=blue]
                              >problem[color=green][color=darkred]
                              >> > fixes itself.
                              >> >
                              >> > 1. I don't know what to delete.
                              >> > 2. If I do delete anything, it will break the[/color][/color][/color]
                              entire project.[color=blue][color=green][color=darkred]
                              >> > 3. I cannot simply paste the code into a new[/color][/color][/color]
                              project because there are[color=blue][color=green]
                              >> far[color=darkred]
                              >> > too many interdependent classes and types and[/color][/color][/color]
                              methods, etc.[color=blue][color=green][color=darkred]
                              >> >
                              >> > Finally, I should point out that, while we must try[/color][/color][/color]
                              to be respectful to[color=blue][color=green][color=darkred]
                              >> > those who help, those who help should be respectful[/color][/color][/color]
                              of these (above)[color=blue][color=green][color=darkred]
                              >> > hindrances. I've done the best I can to provide what[/color][/color][/color]
                              I know without[color=blue][color=green]
                              >> posting[color=darkred]
                              >> > a link to the entire solution in a .zip file, short[/color][/color][/color]
                              of rewriting code[color=blue]
                              >from[color=green][color=darkred]
                              >> > scratch on this matter, which, as I said, will[/color][/color][/color]
                              negate the usefulness of[color=blue][color=green]
                              >> this[color=darkred]
                              >> > group.
                              >> >
                              >> > Seems I have no choice, which is fine. Nobody owes[/color][/color][/color]
                              me anything.[color=blue][color=green][color=darkred]
                              >> >
                              >> > Thanks again for the willingness to try to help.[/color][/color][/color]
                              Please put your tired[color=blue][color=green]
                              >> self[color=darkred]
                              >> > to rest.
                              >> >
                              >> > Jon
                              >> >
                              >> >
                              >> > "Jon Davis" <jon@REMOVE.ME. PLEASE.jondavis .net>[/color][/color][/color]
                              wrote in message[color=blue][color=green][color=darkred]
                              >> > news:umljc%23pT DHA.3796@tk2msf tngp13.phx.gbl. ..
                              >> > > Jon, it took me about half an hour to hand-pick[/color][/color][/color]
                              the relevant lines of[color=blue][color=green]
                              >> code[color=darkred]
                              >> > > that would be useful to you. You are insistent on[/color][/color][/color]
                              not visually[color=blue][color=green]
                              >> evaluating[color=darkred]
                              >> > > what I wrote, which is your prerogative.
                              >> > >
                              >> > > Developing sample code that reproduces the problem[/color][/color][/color]
                              is only possible if[color=blue][color=green]
                              >> you[color=darkred]
                              >> > > know how to reproduce the problem, and I don't[/color][/color][/color]
                              know how to reproduce[color=blue]
                              >the[color=green][color=darkred]
                              >> > > problem. Obviously if someone in this group cannot[/color][/color][/color]
                              help me drill down[color=blue]
                              >to[color=green][color=darkred]
                              >> > the
                              >> > > problem with the information I provided and[/color][/color][/color]
                              without a full[color=blue]
                              >reproduction ,[color=green][color=darkred]
                              >> > > then, in order to provide a reproduction of the[/color][/color][/color]
                              problem, I will have[color=blue]
                              >to[color=green][color=darkred]
                              >> > > rewrite from the ground up, adding line by line[/color][/color][/color]
                              what I've done, until[color=blue]
                              >I[color=green][color=darkred]
                              >> > > discover the culprit (hence, I find what makes it[/color][/color][/color]
                              reproduceable). But[color=blue][color=green]
                              >> that[color=darkred]
                              >> > > will take days, and by the time I find the culprit[/color][/color][/color]
                              I won't need this[color=blue][color=green][color=darkred]
                              >> > > newsgroup.
                              >> > >
                              >> > > Thanks anyway.
                              >> > >
                              >> > > Jon
                              >> > >
                              >> > >
                              >> > > "Jon Skeet" <skeet@pobox.co m> wrote in message
                              >> > >[/color][/color][/color]
                              news:MPG.19846a abd596cfca98a17 6@news.microsof t.com...[color=blue][color=green][color=darkred]
                              >> > > > Jon Davis <jon@REMOVE.ME. PLEASE.jondavis .net>[/color][/color][/color]
                              wrote:[color=blue][color=green][color=darkred]
                              >> > > > > > But there was - if you'd posted a short but[/color][/color][/color]
                              complete example[color=blue]
                              >which[color=green][color=darkred]
                              >> > > > > > *wasn't* working on your box,
                              >> > > > >
                              >> > > > > But see I couldn't do that without giving you[/color][/color][/color]
                              everything.[color=blue][color=green][color=darkred]
                              >> > > >
                              >> > > > But you could. You could have reduced the code[/color][/color][/color]
                              gradually (a copy of[color=blue][color=green]
                              >> the[color=darkred]
                              >> > > > code, rather) until it worked. That would[/color][/color][/color]
                              actually have shown you[color=blue]
                              >the[color=green][color=darkred]
                              >> > > > error very quickly (see below) due to what the[/color][/color][/color]
                              problem turned out to[color=blue][color=green][color=darkred]
                              >> > > > be. If the problem *had* been in the code,[/color][/color][/color]
                              however, you would then[color=blue][color=green]
                              >> have[color=darkred]
                              >> > > > found it when it went from "not working"[/color][/color][/color]
                              to "working". Either way,[color=blue][color=green][color=darkred]
                              >> > > > you'd have found the problem in the end.
                              >> > > >
                              >> > > > > There was absolutely no way to help you help[/color][/color][/color]
                              me by reproducing[color=blue][color=green]
                              >> sample[color=darkred]
                              >> > > code
                              >> > > > > in new project code because I wouldn't have[/color][/color][/color]
                              repeated the same[color=blue]
                              >error[color=green][color=darkred]
                              >> > > (unless
                              >> > > > > per chance I actually caught myself along the[/color][/color][/color]
                              way).[color=blue][color=green][color=darkred]
                              >> > > >
                              >> > > > Which you should have done, because immediately[/color][/color][/color]
                              after copying the[color=blue]
                              >full[color=green][color=darkred]
                              >> > > > code, the first thing to do would be to test[/color][/color][/color]
                              that it still didn't[color=blue][color=green]
                              >> work.[color=darkred]
                              >> > > >
                              >> > > > > Thanks again for your insightful question (re[/color][/color][/color]
                              your previous post,[color=blue][color=green][color=darkred]
                              >> > > "Release
                              >> > > > > mode"), it actually really helped me drill[/color][/color][/color]
                              down to the problem,[color=blue]
                              >and[color=green][color=darkred]
                              >> > > frankly
                              >> > > > > I don't know how else I would have found my[/color][/color][/color]
                              error.[color=blue][color=green][color=darkred]
                              >> > > >
                              >> > > > See above.
                              >> > > >
                              >> > > > --
                              >> > > > Jon Skeet - <skeet@pobox.co m>
                              >> > > > http://www.pobox.com/~skeet/
                              >> > > > If replying to the group, please do not mail me[/color][/color][/color]
                              too[color=blue][color=green][color=darkred]
                              >> > >
                              >> > >
                              >> >
                              >> >[/color]
                              >>
                              >>[/color]
                              >
                              >
                              >.
                              >[/color]

                              Comment

                              Working...