Leak in RuntimeBinder when using “dynamic” keyword with __ComObject

后端 未结 2 1007
自闭症患者
自闭症患者 2021-01-06 04:20

Does anybody know if there is a way of preventing a memory leak in RuntimeBinder when using \"dynamic\" keyword with __ComObject instances in C#?

I got the following

2条回答
  •  太阳男子
    2021-01-06 05:12

    I had a similar problem: Using "dynamic" caused a memory leak.

    I solved this in the following way:

    using (dynamic attr = curve.Attributes)
    {
      if (attr != null)
        return attr.InternalLabel;
    }
    

提交回复
热议问题