COM object from c#. The property is accessed?

Hello, now I will try to put the essence of the problem:

Registered and connected to the project a number of com libraries.

Get the value like this:

Com ComObject1 = new ComObject1();<br>
string name = com.get_Property("name") as string;



set the value like this:
((dynamic)com).name = "Vasiliy";


You are not working with a single object and multiple.

So:


1. Sometimes, in the setter of the properties of a class that includes this com-object, when set the name property for the com object falls out of eksepsi:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt



2.Okay, set this property only in the constructor of this class, so everything goes with a Bang. Well, cheers and God be with him. But no, after this, from the constructor is invoked, the work on the collection of some other com objects, which also contain a field Name. So after installing the first, the name does not define the name field for objects in the collection. Does not have the invoke Name.

These objects are not connected. If not I will set the name to work with a collection, the properties in the objects within the collection is normally put.


In short some such nonsense going on.

Anybody with such did not face?
October 8th 19 at 01:43
1 answer
October 8th 19 at 01:45
Periodically I see such "nonsense" working with COM and always are the cause of the error in memory in the COM library (for example, premature destruction of the object due to errors in reference counting). Can't say that this is the case, but very similar.

Find more questions by tags Component Object Model.NET