none
pure virtual function call - Error

    Question

  • Hi friends,
     
       I am developing one product in windows application (Visual Studio 2008). Language is C#.

    I want to capture images from capture devices. For this purpose i am using one third party tool and successfully working in one windows form.  In the windows form i have 6 picture boxes to take snaps from the device. I have the third party ocx in the page so that the preview showing in that control when start...In the same page working nicely.

    Now the requirement is,  when i click a button one new window shown with the big preview (full screen idea). In that page they select 6 images and come back. So the older page picture boxes update the selected images.

    I implemented this. For getting the images i use one image array in the Preview page and store the captured images. In the first page activated event i call this image array and put the images ( use property for image array in the second page).

    But now when i access that preview page and update image for 2 - 3 time i got the error  "Runtime Error R6025 - pure virtual call function"

    Please help to clear this...its very urgent....
    Thursday, September 10, 2009 7:34 AM

Answers

  • Here is a bit of troubleshooting info that may be valuable; however, I'm afraid that the problem is within the third-party component you are using.

    As you can notice, the error message is shown by the C++ Runtime, which means that the problem arises from C++ code. The C++ concept of a "pure virtual function" is (almost) the same as an abstract method in C#.

    In .Net managed code it is, in principle, impossible to call an abstract / pure virtual method: the compiler requires any class containing such methods to be abstract itself, and it won't allow you to directly create instances of abstract classes: you'd use derived classes that provide implementations for all abstract members instead (as long as there is something abstract that isn't yet implemented, be it inherited from a base abstract class or defined by the class itself, the class must be abstract or the compiler will reject it). Thus, we have that the code causing the error is not .Net managed code.

    Taking both facts together, we can conclude that the problem is within some piece of native C++ code. This can only mean one of two things: either you are using native C++ code on your own, in which case further details could help providing an answer to your issue here; or the problem is deep within the OCX. While native C++ compilers are less restrictive and assume that the code author knows what s/he is doing, having calls to abstract (or pure virtual) methods is normally a symptom of something wrong in the code.

    If the problem is actually in the OCX (which I think it's most likely), I'm afraid this is the furthest I (and probably, anyone else on these forums) can help you with your issue. You should check the documentation for the component and/or address to the component's authors. Here are a few tips:
    • Isolate the issue : try to figure out on which situations the problem arises; then remove anything non-relevant to the problem. Ideally, you should get the simplest possible code that triggers the error: this helps troubleshooting as it allows discarding everything that is unrelated and focusing on what actually causes the problem. While this would be almost utopic, the closer you can get to it, the better.
    • Do your homework : check the docs of the component, maybe the answer is there (if the component is documented at all, of course). Then search the web: if it's a widely used component, chances are high that someone else has stepped before into the same problem you have. Try "<component's name> R6025" and "<component's name> pure virtual function call" on your favorite search engine, then try it on other major search engines. If the component's author have support forums or archived support mailing lists, search also there.
    • Use the best channel : if the author of the component clearly states that there is a preferred form to request support, use that first. By default, the typical order you should follow to request support for something is docs & FAQs, support forums, general forums, support mailing lists, general mailing lists. Use direct e-mailing to the component author only as a last resort, if no better support channel is available. Even if you find no other choice than mailing the author, I'd suggest starting your mail summarizing which resources have you tried, asking for any other resources you could try, and only then explaining your problem.
    • Get due attention : Native C++ is not for the light-hearted. Hence, chances are high that the authors are significantly experienced in low-level programming and quite full of themselves; so you'd better avoid being taken as a "noob" or "time-sink". Start your e-mail/post/message/whatever with a very brief summary of the problem, like "I'm getting a R6025 - pure virtual function call error when using <component's name>", then summarize which resources have you tried before asking for help (include links to search results and other sources), and finally go to the meat of the issue. To round it off, ask if there is any detail you could provide to help troubleshooting the problem, and thank in advance the effort taken to try to solve the issue (be polite, but not to the extreme of self-humiliating; and don't apologize for asking for help (at much you might have to apologize for asking it on the wrong place)). This should make even the most snobbish hacker to treat you with the respect and seriousness you deserve (it's hard to know in advance what kind of people will be replying to your problem, so it's safest to be covered for the worst case).
    Hope this helps, and good luck.

    Regards,
    Herenvardö
    Thursday, September 10, 2009 5:07 PM
  • It is a not uncommon bug in unmanaged C++ code.  You'll need to contact the vendor of the library or device you use to get support.

    Hans Passant.
    Friday, September 11, 2009 2:14 AM

All replies

  • Here is a bit of troubleshooting info that may be valuable; however, I'm afraid that the problem is within the third-party component you are using.

    As you can notice, the error message is shown by the C++ Runtime, which means that the problem arises from C++ code. The C++ concept of a "pure virtual function" is (almost) the same as an abstract method in C#.

    In .Net managed code it is, in principle, impossible to call an abstract / pure virtual method: the compiler requires any class containing such methods to be abstract itself, and it won't allow you to directly create instances of abstract classes: you'd use derived classes that provide implementations for all abstract members instead (as long as there is something abstract that isn't yet implemented, be it inherited from a base abstract class or defined by the class itself, the class must be abstract or the compiler will reject it). Thus, we have that the code causing the error is not .Net managed code.

    Taking both facts together, we can conclude that the problem is within some piece of native C++ code. This can only mean one of two things: either you are using native C++ code on your own, in which case further details could help providing an answer to your issue here; or the problem is deep within the OCX. While native C++ compilers are less restrictive and assume that the code author knows what s/he is doing, having calls to abstract (or pure virtual) methods is normally a symptom of something wrong in the code.

    If the problem is actually in the OCX (which I think it's most likely), I'm afraid this is the furthest I (and probably, anyone else on these forums) can help you with your issue. You should check the documentation for the component and/or address to the component's authors. Here are a few tips:
    • Isolate the issue : try to figure out on which situations the problem arises; then remove anything non-relevant to the problem. Ideally, you should get the simplest possible code that triggers the error: this helps troubleshooting as it allows discarding everything that is unrelated and focusing on what actually causes the problem. While this would be almost utopic, the closer you can get to it, the better.
    • Do your homework : check the docs of the component, maybe the answer is there (if the component is documented at all, of course). Then search the web: if it's a widely used component, chances are high that someone else has stepped before into the same problem you have. Try "<component's name> R6025" and "<component's name> pure virtual function call" on your favorite search engine, then try it on other major search engines. If the component's author have support forums or archived support mailing lists, search also there.
    • Use the best channel : if the author of the component clearly states that there is a preferred form to request support, use that first. By default, the typical order you should follow to request support for something is docs & FAQs, support forums, general forums, support mailing lists, general mailing lists. Use direct e-mailing to the component author only as a last resort, if no better support channel is available. Even if you find no other choice than mailing the author, I'd suggest starting your mail summarizing which resources have you tried, asking for any other resources you could try, and only then explaining your problem.
    • Get due attention : Native C++ is not for the light-hearted. Hence, chances are high that the authors are significantly experienced in low-level programming and quite full of themselves; so you'd better avoid being taken as a "noob" or "time-sink". Start your e-mail/post/message/whatever with a very brief summary of the problem, like "I'm getting a R6025 - pure virtual function call error when using <component's name>", then summarize which resources have you tried before asking for help (include links to search results and other sources), and finally go to the meat of the issue. To round it off, ask if there is any detail you could provide to help troubleshooting the problem, and thank in advance the effort taken to try to solve the issue (be polite, but not to the extreme of self-humiliating; and don't apologize for asking for help (at much you might have to apologize for asking it on the wrong place)). This should make even the most snobbish hacker to treat you with the respect and seriousness you deserve (it's hard to know in advance what kind of people will be replying to your problem, so it's safest to be covered for the worst case).
    Hope this helps, and good luck.

    Regards,
    Herenvardö
    Thursday, September 10, 2009 5:07 PM
  • It is a not uncommon bug in unmanaged C++ code.  You'll need to contact the vendor of the library or device you use to get support.

    Hans Passant.
    Friday, September 11, 2009 2:14 AM
  • k thanks i will check that
    Tuesday, September 15, 2009 7:15 AM