[DllImport("advapi32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ControlService(IntPtr hService, ServiceControl dwControl, ref ServiceStatus lpServiceStatus);
[StructLayout(LayoutKind.Sequential)]
public struct ServiceStatus
{
ScServiceType dwServiceType;
ServiceState dwCurrentState;
ServiceAccept dwControlsAccepted;
int dwWin32ExitCode;
int dwServiceSpecificExitCode;
uint dwCheckPoint;
uint dwWaitHint;
}
With the code above, select ControlService in the VA Outline window and move the code to another place in the source. The attributes are totally off now, instead of taking the [DllImport] and [return:] attributes with it, it takes the [StructLayout]. Bad, very bad.