CA2205 : UseManagedEquivalentsOfWin32Api in Win32API.cs - SHGetFolderPath()



wrote Jun 25, 2007 at 6:43 PM

Description: CA2205 : Microsoft.Usage : Remove the declaration for 'NativeMethods.SHGetFolderPath(IntPtr, Int32, IntPtr, Int32, StringBuilder):Int32'. Callers should use the following managed alternative: System.Environment.GetFolderPath
File: C:\Documents and Settings\msmithlo\My Documents\personal\VS2005 Projects\EFSAssistant\EFSAssistant\Win32API.cs
Line: 23
Project: EFSAssistant

DaveMo wrote Jul 28, 2007 at 3:55 PM

For any functionality where we had to use the unmanaged equivalent, it was because the managed version didn't function correctly. I don't know what the point of this issue is since if we revert to the managed equivalent something would stop working correctly.

MikeSL wrote Jul 29, 2007 at 11:44 PM

Dave (and others), this bug is called straight out of FxCop.

Any non-standard implementations in a shared-source project are one heckuva lot easier to support, and preserve as an exception, with documentation or comments to clarify what issues such a non-standard implementation are meant to workaround.

If anyone knows what issues this would resurrect, their input would be MOST appreciated.