<Type Name="MarshalStringsInPInvokeDeclarationsRule" FullName="Gendarme.Rules.Interoperability.MarshalStringsInPInvokeDeclarationsRule">
  <TypeSignature Language="C#" Value="public class MarshalStringsInPInvokeDeclarationsRule : Gendarme.Framework.Rule, Gendarme.Framework.IMethodRule" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MarshalStringsInPInvokeDeclarationsRule extends Gendarme.Framework.Rule implements class Gendarme.Framework.IMethodRule, class Gendarme.Framework.IRule" />
  <AssemblyInfo>
    <AssemblyName>Gendarme.Rules.Interoperability</AssemblyName>
    <AssemblyVersion>2.11.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>Gendarme.Framework.Rule</BaseTypeName>
  </Base>
  <Interfaces>
    <Interface>
      <InterfaceName>Gendarme.Framework.IMethodRule</InterfaceName>
    </Interface>
  </Interfaces>
  <Attributes>
    <Attribute>
      <AttributeName>Gendarme.Framework.FxCopCompatibility("Microsoft.Globalization", "CA2101:SpecifyMarshalingForPInvokeStringArguments")</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Problem("Marshaling information for string types is missing and what is required may be different from what you expected the default to be.")</AttributeName>
    </Attribute>
    <Attribute>
      <AttributeName>Gendarme.Framework.Solution("Add [DllImport CharSet=] to the method or [MarshalAs] on the parameter(s)")</AttributeName>
    </Attribute>
  </Attributes>
  <Docs>
    <summary>
            This rule will fire if a P/Invoke method has System.String or System.Text.StringBuilder
            arguments, and the DllImportAttribute does not specify the <code>CharSet</code>,
            and the string arguments are not decorated with <code>[MarshalAs]</code>.
            This is important because the defaults are different on the various platforms.
            On Mono the default is to always use utf-8. On .NET the default is to use the ANSI
            CharSet which is the native encoding and will typically be some variant of ASCII or
            something like Shift-JIS. On Compact .NET the default is utf-16.
            </summary>
    <remarks>To be added.</remarks>
    <example>
            Bad example:
            <code>
            [DllImport ("coredll")]
            static extern int SHCreateShortcut (StringBuilder szShortcut, StringBuilder szTarget);
            </code></example>
    <example>
            Good examples:
            <code>
            [DllImport ("coredll", CharSet = CharSet.Auto)]
            static extern int SHCreateShortcut (StringBuilder szShortcut, StringBuilder szTarget);
            [DllImport ("coredll")]
            static extern int SHCreateShortcut ([MarshalAs (UnmanagedType.LPTStr)] StringBuilder szShortcut,
            	[MarshalAs (UnmanagedType.LPTStr)] StringBuilder szTarget);
            </code></example>
  </Docs>
  <Members>
    <Member MemberName=".ctor">
      <MemberSignature Language="C#" Value="public MarshalStringsInPInvokeDeclarationsRule ();" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
      <MemberType>Constructor</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.11.0.0</AssemblyVersion>
      </AssemblyInfo>
      <Parameters />
      <Docs>
        <summary>To be added.</summary>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
    <Member MemberName="CheckMethod">
      <MemberSignature Language="C#" Value="public Gendarme.Framework.RuleResult CheckMethod (Mono.Cecil.MethodDefinition method);" />
      <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype Gendarme.Framework.RuleResult CheckMethod(class Mono.Cecil.MethodDefinition method) cil managed" />
      <MemberType>Method</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>2.11.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>Gendarme.Framework.RuleResult</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="method" Type="Mono.Cecil.MethodDefinition" />
      </Parameters>
      <Docs>
        <param name="method">To be added.</param>
        <summary>To be added.</summary>
        <returns>To be added.</returns>
        <remarks>To be added.</remarks>
      </Docs>
    </Member>
  </Members>
</Type>
