Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
i'm using the "Acrobat Reader" COM-Component in a Form, for displaying PDF-Components.
When the Form is closed, an Access Violation Exception is thrown.

// Auto generated Code in Form.Designer.cs
/// <summary>
     /// Clean up any resources being used.
     /// </summary>
     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     protected override void Dispose(bool disposing)
     {
         if (disposing && (components != null))
         {
             components.Dispose();
         }
         base.Dispose(disposing); // here the Exception is thrown
     }


What I have tried:

I Tried:

1. Removing the Component from the this.components Collection of the Form.// Same Result
2. Loading an not existing Document, to clear the Component. // Same Result
3. Marshal.ReleaseComObject(axAcroPDF1); // Exception Not a COM-Object
Posted
Updated 14-May-19 20:21pm
v2

1 solution

base.Dispose(disposing);// Here the Exception is thrown


You've "disposed" of the (unmanaged) "component" (component.Dispose()), and are now attempting to dispose the live managed form itself ... from the looks of it. Not logical.
 
Share this answer
 
Comments
Member 14135667 15-May-19 2:26am    
The Code is auto generated from the designer in the pertial class.
What I tried was in the form-closing event.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900