Questions tagged [rcw]

The common language runtime exposes COM objects through a proxy called the runtime callable wrapper (RCW). Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.

Runtime Callable Wrapper

The runtime creates exactly one RCW for each COM object, regardless of the number of references that exist on that object. The runtime maintains a single RCW per process for each object. If you create an RCW in one application domain or apartment, and then pass a reference to another application domain or apartment, a proxy to the first object will be used. As the following illustration shows, any number of managed clients can hold a reference to the COM objects that expose INew and INewer interfaces.

http://msdn.microsoft.com/en-us/library/8bwh56xe(v=vs.110).aspx

63 questions
1
vote
0 answers

Application crashed with access violation exception (0xC0000005) when exiting

The application is a WPF application based on .NET Framework 4.5. It is built in x86 mode, and running on Windows 7 (32bit). When exiting the application by clicking the close button of the main window, it crashed sometimes. This is main info…
WPInfo
  • 1,066
  • 1
  • 8
  • 21
1
vote
1 answer

Getting RCW value of System.__ComObject in windbg script

I am trying to write a Windbg script where i have 1k addresses in a file. For each address, at offset 0x30 is a COM object. I want to get all native pointers from COM object. I know how to do it manually like below. I am having trouble for iterating…
Ashish Negi
  • 5,193
  • 8
  • 51
  • 95
1
vote
1 answer

Closing Excel Workbook - System.Runtime.InteropServices.COMException : Exception from HRESULT: 0x800A03EC

I've put in the following method that returns a value from an XLS file cell : public static string ReadFromExcel(string filePath, int sheetNum, int xCell, int yCell) { List rowValue = new List {}; var…
entrup
  • 113
  • 3
  • 16
1
vote
3 answers

Visual Studio OrderedTests: COM object that has been separated from its underlying RCW cannot be used

First off, the technologies being used here include: Visual Studio, C#, Selenium WebDriver, Google Chrome, and MS Excel. I'm in the process of building an automation framework to test multiple web applications. I'm using an Excel spreadsheet to pull…
1
vote
2 answers

What circumstances other than "await" will allow synchronous code to be interrupted

I recently came across a strange bug in my async code. I was calling a blocking method on a COM control, which appeared to allow my async continuations to run while it was blocking. Consider example code (illustrative purposes only) public async…
GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
1
vote
0 answers

How would I make garbage collection clean up RCW objects bound to an out-proc COM server?

I have a 64-bit .NET process that runs for days. The process consumes a native 32-bit COM server using DCOM. Once in a while the COM server runs out of memory because the .NET process garbage collector only sees the RCWs of the COM objects and those…
sharptooth
  • 167,383
  • 100
  • 513
  • 979
1
vote
1 answer

Why is the generated wrapper for property type selecting this interface?

When I ask Visual Studio to generate runtime callable wrappers for my COM components, it is selecting a strange type to wrap a certain interface property. This is a summarized type library for component A: // Generated .IDL file (by the OLE/COM…
Pedro Lamarão
  • 531
  • 5
  • 22
1
vote
1 answer

VB.NET Track COM RCW error

I have a really big project that I can not easily strip down. When the application is being closed, I get the error "InvalidComObjectException: A COM object that has been disconnected from the RCW can not be…
tmighty
  • 10,734
  • 21
  • 104
  • 218
1
vote
0 answers

Release build introduces bugs with COM objects

I have a clas library in which I use OutlookStorage.cs to read an (Outlook .msg) email and the attachments within that email. I open each attachment with a custom document viewer which converts whatever the attachment is to a PDF. In debug mode,…
Marc K
  • 392
  • 3
  • 11
1
vote
1 answer

Using 32 bit interop dll in 64 bit application

I am little confused about using 32 bit interop dll with 64 bit process. In order to get access to 8TB of memory I am going to build my application for 64 bit, unfortunately it uses some statistical interop library which is build in 32 bit mode. I…
jotbek
  • 1,479
  • 3
  • 14
  • 22
0
votes
1 answer

Is there any way to handle when COM object is disconnected from RCW?

Is there any way to run code when COM object is about to be disconnected from RCW without implementing IDisposale interface and explicit call MyObject.Dispose in client code? The code below is not working. When program enters Finalize sub,…
xll
  • 3,019
  • 2
  • 16
  • 19
0
votes
0 answers

Debugging a (marshalled) RCW proxy blocks the message loop on the COM server - why?

I have a simple process that accesses the Excel application object. It subscribes to an event and then attaches a debugger to itself. The entire source code of the app is as follows: void Main() { var excel =…
anakic
  • 2,746
  • 1
  • 30
  • 32
0
votes
0 answers

.net interop System.Runtime.InteropServices.Marshal.InternalWrapIUnknownWithComObject dead lock in some occasions

we are experiencing a deadlock when trying to use a RCW in C# code which is wrapping a C++ Com object. It works most of the time, but now and then we have a deadlock where the main thread stops at : Child SP IP Call Site 0019ad34 75002b3c…
Marco
  • 984
  • 10
  • 18
0
votes
0 answers

How to Reference Edited Interop Assemblies

I have been working through Enumerating Windows Portable Devices in C#, which among other things says to edit a Runtime Callable Wrapper (RCW) generated for the PortableDeviceApi COM object, since the default COM type library import process gets the…
Bondolin
  • 2,793
  • 7
  • 34
  • 62
0
votes
1 answer

COM object that has been separated from its underlying RCW cannot be used using Microsoft.Office.Interop.Outlook

I'm facing the following issue COM object that has been separated from its underlying RCW cannot be used.' System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used. …
joesid
  • 671
  • 1
  • 10
  • 21