You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/code-quality/ca2001.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -35,18 +35,18 @@ Avoid making unnecessary and potentially dangerous method calls. A violation of
35
35
|Method|Description|
36
36
|------------|-----------------|
37
37
|<xref:System.GC.Collect%2A?displayProperty=fullName>|Calling GC.Collect can significantly affect application performance and is rarely necessary. For more information, see [Rico Mariani's Performance Tidbits](http://go.microsoft.com/fwlink/?LinkId=169256) blog entry on MSDN.|
38
-
|<xref:System.Threading.Thread.Resume%2A?displayProperty=fullName><br /><br /><xref:System.Threading.Thread.Suspend%2A?displayProperty=fullName>|Thread.Suspend and Thread.Resume have been deprecated because of their unpredictable behavior. Use other classes in the <xref:System.Threading> namespace, such as <xref:System.Threading.Monitor>, <xref:System.Threading.Mutex>, and <xref:System.Threading.Semaphore>, to synchronize threads or protect resources.|
39
-
|<xref:System.Runtime.InteropServices.SafeHandle.DangerousGetHandle%2A?displayProperty=fullName>|The DangerousGetHandle method poses a security risk because it can return a handle that is not valid. See the <xref:System.Runtime.InteropServices.SafeHandle.DangerousAddRef%2A> and the <xref:System.Runtime.InteropServices.SafeHandle.DangerousRelease%2A> methods for more information about how to use the DangerousGetHandle method safely.|
40
-
|<xref:System.Reflection.Assembly.LoadFrom%2A?displayProperty=fullName><br /><br /><xref:System.Reflection.Assembly.LoadFile%2A?displayProperty=fullName><br /><br /><xref:System.Reflection.Assembly.LoadWithPartialName%2A?displayProperty=fullName>|These methods can load assemblies from unexpected locations. For example, see Suzanne Cook's .NET CLR Notes blog posts [LoadFile vs. LoadFrom](http://go.microsoft.com/fwlink/?LinkId=164450) and [Choosing a Binding Context](http://go.microsoft.com/fwlink/?LinkId=164451) for information about methods that load assemblies.|
41
-
|[CoSetProxyBlanket](http://go.microsoft.com/fwlink/?LinkID=169250) (Ole32)<br /><br />[CoInitializeSecurity](http://go.microsoft.com/fwlink/?LinkId=169255) (Ole32)|By the time the user code starts executing in a managed process, it is too late to reliably call CoSetProxyBlanket. The common language runtime (CLR) takes initialization actions that may prevent the users P/Invoke from succeeding.<br /><br />If you do have to call CoSetProxyBlanket for a managed application, we recommend that you start the process by using a native code (C++) executable, call CoSetProxyBlanket in the native code, and then start your managed code application in process. (Be sure to specify a runtime version number.)|
38
+
|<xref:System.Threading.Thread.Resume%2A?displayProperty=fullName><br /><br /><xref:System.Threading.Thread.Suspend%2A?displayProperty=fullName>|Thread.Suspend and Thread.Resume have been deprecated because of their unpredictable behavior. Use other classes in the <xref:System.Threading> namespace, such as <xref:System.Threading.Monitor>, <xref:System.Threading.Mutex>, and <xref:System.Threading.Semaphore>, to synchronize threads or protect resources.|
39
+
|<xref:System.Runtime.InteropServices.SafeHandle.DangerousGetHandle%2A?displayProperty=fullName>|The `DangerousGetHandle` method poses a security risk because it can return a handle that's not valid. For more information about how to use the `DangerousGetHandle` method safely, see the <xref:System.Runtime.InteropServices.SafeHandle.DangerousAddRef%2A> and <xref:System.Runtime.InteropServices.SafeHandle.DangerousRelease%2A> methods.|
40
+
|<xref:System.Reflection.Assembly.LoadFrom%2A?displayProperty=fullName><br /><br /><xref:System.Reflection.Assembly.LoadFile%2A?displayProperty=fullName><br /><br /><xref:System.Reflection.Assembly.LoadWithPartialName%2A?displayProperty=fullName>|These methods can load assemblies from unexpected locations. For example, see Suzanne Cook's .NET CLR Notes blog posts [LoadFile vs. LoadFrom](http://go.microsoft.com/fwlink/?LinkId=164450) and [Choosing a Binding Context](http://go.microsoft.com/fwlink/?LinkId=164451) for information about methods that load assemblies.|
41
+
|[CoSetProxyBlanket](/windows/win32/api/combaseapi/nf-combaseapi-cosetproxyblanket)<br /><br />[CoInitializeSecurity](/windows/win32/api/combaseapi/nf-combaseapi-coinitializesecurity)|By the time the user code starts executing in a managed process, it's too late to reliably call `CoSetProxyBlanket`. The common language runtime (CLR) takes initialization actions that may prevent the users P/Invoke from succeeding.<br /><br />If you do have to call `CoSetProxyBlanket` for a managed application, we recommend that you start the process by using a native code (C++) executable, call `CoSetProxyBlanket` in the native code, and then start your managed code application in process. (Be sure to specify a runtime version number.)|
42
42
43
43
## How to fix violations
44
44
45
45
To fix a violation of this rule, remove or replace the call to the dangerous or problematic method.
46
46
47
47
## When to suppress warnings
48
48
49
-
You should suppress messages from this rule only when no alternatives to the problematic method are available.
49
+
Suppress messages from this rule only when no alternatives to the problematic method are available.
0 commit comments