Click here to Skip to main content
15,847,583 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Tridip Bhattacharjee5-Feb-17 11:43
professionalTridip Bhattacharjee5-Feb-17 11:43 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Dave Kreskowiak5-Feb-17 18:52
mveDave Kreskowiak5-Feb-17 18:52 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Pete O'Hanlon5-Feb-17 22:05
subeditorPete O'Hanlon5-Feb-17 22:05 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Tridip Bhattacharjee5-Feb-17 23:51
professionalTridip Bhattacharjee5-Feb-17 23:51 
GeneralRe: How to run ppt slide one after one by Process.Start Pin
Dave Kreskowiak6-Feb-17 4:00
mveDave Kreskowiak6-Feb-17 4:00 
QuestionRegistries in Windows 10 Pro Pin
picasso23-Feb-17 15:40
picasso23-Feb-17 15:40 
AnswerRe: Registries in Windows 10 Pro Pin
Richard MacCutchan3-Feb-17 23:10
mveRichard MacCutchan3-Feb-17 23:10 
QuestionCOM object that has been separated from its underlying RCW cannot be used. Pin
hpjchobbes3-Feb-17 5:48
hpjchobbes3-Feb-17 5:48 
I am using a third party reference, which is a COM object. The COM object has an Open and Close function and I need to make sure that Close is always called whenever possible. I wrote a wrapper class that implements IDisposable and in the Dispose function, I try to call the Close function. However I get a System.Runtime.InteropServices.InvalidComObjectException when I try to call the close function with additional details of "COM object that has been separated from its underlying RCW cannot be used."
public class MyWrapper : IDisposable
{
    private Session _mySession = new Session(); // This is the COM object

    public void Open() { _MySession.Open(); }
    public void Close() { _MySession.Close(); }

    public void Dispose() {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public void Dispose(bool disposing) {
        _MySession.Close(); // Calling close without having called open is OK
    }
    ~MyWrapper() { Dispose(false); }    
}

From my (limited) understanding, there are two reasons why I am getting the exception.
1) The Finalizer is running and calling the destructor, but because the finalizer is on a separate thread I get the error.
2) Based on this Stack Overflow[^] post, the Runtime Callable Wrapper (RCW) has it's own finalizer which is being called before mine, and getting rid of the COM object.

I don't know if either of these, or both of these are true, but what is the recommended way to implement a COM object that needs to have finalizer code run?
QuestionAccess Network Share with a Microsoft HoloLens Pin
Member 127713943-Feb-17 5:01
Member 127713943-Feb-17 5:01 
QuestionRe: Access Network Share with a Microsoft HoloLens Pin
Richard MacCutchan3-Feb-17 7:42
mveRichard MacCutchan3-Feb-17 7:42 
QuestionRe: Access Network Share with a Microsoft HoloLens Pin
Member 127713943-Feb-17 8:02
Member 127713943-Feb-17 8:02 
QuestionRate my codes please? Pin
Member 111381293-Feb-17 2:06
Member 111381293-Feb-17 2:06 
AnswerRe: Rate my codes please? Pin
OriginalGriff3-Feb-17 2:26
mveOriginalGriff3-Feb-17 2:26 
SuggestionRe: Rate my codes please? Pin
Richard Deeming3-Feb-17 2:54
mveRichard Deeming3-Feb-17 2:54 
QuestionMessage Closed Pin
3-Feb-17 0:48
professionalTEProjects3-Feb-17 0:48 
AnswerRe: How to use C# ArrayList ? Pin
Midi_Mick3-Feb-17 0:52
professionalMidi_Mick3-Feb-17 0:52 
GeneralRe: How to use C# ArrayList ? Pin
TEProjects3-Feb-17 21:54
professionalTEProjects3-Feb-17 21:54 
AnswerRe: How to use C# ArrayList ? Pin
Jochen Arndt3-Feb-17 0:55
professionalJochen Arndt3-Feb-17 0:55 
GeneralRe: How to use C# ArrayList ? Pin
TEProjects3-Feb-17 21:55
professionalTEProjects3-Feb-17 21:55 
AnswerRe: How to use C# ArrayList ? Pin
Afzaal Ahmad Zeeshan3-Feb-17 1:00
professionalAfzaal Ahmad Zeeshan3-Feb-17 1:00 
GeneralRe: How to use C# ArrayList ? Pin
TEProjects3-Feb-17 21:57
professionalTEProjects3-Feb-17 21:57 
AnswerRe: How to use C# ArrayList ? Pin
OriginalGriff3-Feb-17 1:09
mveOriginalGriff3-Feb-17 1:09 
AnswerRe: How to use C# ArrayList ? Pin
JACOB-TANZANIA3-Feb-17 22:51
professionalJACOB-TANZANIA3-Feb-17 22:51 
Questionc# WebBrowser returns unauthorized for different domain users Pin
kubiiik2-Feb-17 5:40
kubiiik2-Feb-17 5:40 
AnswerRe: c# WebBrowser returns unauthorized for different domain users Pin
Eddy Vluggen3-Feb-17 1:53
professionalEddy Vluggen3-Feb-17 1:53 

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

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