View Issue Details

IDProjectCategoryView StatusLast Update
0000115.NET APIImplementation Bugpublic2012-10-05 03:35
ReporterRandy Armstrong Assigned Touser322 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Summary0000115: .NET API uses the lock(this) statements in violation of coding guidelines
Description

The OPC NET API/COM Wrapper violates Microsoft recommended practices, with respect to the C# lock statement, in hundreds of locations. Here is an excerpt from an MSDN article:

In general, avoid locking on a public type, or instances beyond your code's control. The common constructs lock (this), lock (typeof (MyType)), and lock ("myLock") violate this guideline:

lock (this) is a problem if the instance can be accessed publicly.
lock (typeof (MyType)) is a problem if MyType is publicly accessible.
lock("myLock") is a problem since any other code in the process using the same string, will share the same lock.
Best practice is to define a private object to lock on, or a private shared object variable to protect data common to all instances.

TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2007-02-22 05:39 Randy Armstrong New Issue
2007-02-22 05:39 Randy Armstrong Status new => assigned
2007-02-22 05:39 Randy Armstrong Assigned To => Randy Armstrong
2012-10-05 03:35 Randy Armstrong Assigned To Randy Armstrong => user322