Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82686 --- shadow/82686 2007-09-04 03:24:49.000000000 -0400 +++ shadow/82686.tmp.9625 2007-09-04 03:24:49.000000000 -0400 @@ -0,0 +1,92 @@ +Bug#: 82686 +Product: Mono: Compilers +Version: unspecified +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Minor +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: CS0169 should not be reported when the type is used for unmanaged calls + +In some cases we have to add extra fields that are only used in unmanaged +calls. For those cases we don't want CS0169 be warned. + +-------- +// This sample contains lots of extraneous fields that could be removed. +// They can be removed. They are just to show how it is used practically. +using System; +using System.Runtime.InteropServices; + + class SspiMarshal + { + [DllImport ("secur32.dll")] + internal static extern SspiSecurityFunctionTable InitSecurityInterface (); + } + + struct SspiSecurityFunctionTable + { + public uint Version; + public IntPtr EnumerateSecurityPackages; // ENUMERATE_SECURITY_PACKAGES_FN + IntPtr Reserved1; + public IntPtr QueryCredentialsAttributes; // QUERY_CREDENTIAL_ATTRIBUTES_FN + public IntPtr AcquireCredentialsHandle; // ACQUIRE_CREDENTIALS_HANDLE_FN + public IntPtr FreeCredentialsHandle; // FREE_CREDENTIALS_HANDLE_FN + IntPtr Reserved2; + public IntPtr InitializeSecurityContext; // INITIALIZE_SECURITY_CONTEXT_FN + public IntPtr AcceptSecurityContext; // ACCEPT_SECURITY_CONTEXT_FN + public IntPtr CompleteAuthToken; // COMPLETE_AUTH_TOKEN_FN + public IntPtr DeleteSecurityContext; // DELETE_SECURITY_CONTEXT_FN + public IntPtr ApplyControlToken; // APPLY_CONTROL_TOKEN_FN + public IntPtr QueryContextAttributes; // QUERY_CONTEXT_ATTRIBUTES_FN + public IntPtr ImpersonateSecurityContext; // IMPERSONATE_SECURITY_CONTEXT_FN + public IntPtr RevertSecurityContext; // REVERT_SECURITY_CONTEXT_FN + public IntPtr MakeSignature; // MAKE_SIGNATURE_FN + public IntPtr VerifySignature; // VERIFY_SIGNATURE_FN + public IntPtr FreeContextBuffer; // FREE_CONTEXT_BUFFER_FN + public IntPtr QuerySecurityPackageInfo; // QUERY_SECURITY_PACKAGE_INFO_FN + IntPtr Reserved3; + IntPtr Reserved4; + public IntPtr ExportSecurityContext; // EXPORT_SECURITY_CONTEXT_FN + public IntPtr ImportSecurityContext; // IMPORT_SECURITY_CONTEXT_FN + public IntPtr AddCredentials; // ADD_CREDENTIALS_FN + IntPtr Reserved8; + public IntPtr QuerySecurityContextToken; // QUERY_SECURITY_CONTEXT_TOKEN_FN + public IntPtr EncryptMessage; // ENCRYPT_MESSAGE_FN + public IntPtr DecryptMessage; // DECRYPT_MESSAGE_FN + public IntPtr SetContextAttributes; // SET_CONTEXT_ATTRIBUTES_FN + } +-------- + + +Actual Results: + +cs0169.cs(16,24): warning CS0169: The private field +`SspiSecurityFunctionTable.Reserved1' is never used +cs0169.cs(20,24): warning CS0169: The private field +`SspiSecurityFunctionTable.Reserved2' is never used +cs0169.cs(33,24): warning CS0169: The private field +`SspiSecurityFunctionTable.Reserved3' is never used +cs0169.cs(34,24): warning CS0169: The private field +`SspiSecurityFunctionTable.Reserved4' is never used +cs0169.cs(38,24): warning CS0169: The private field +`SspiSecurityFunctionTable.Reserved8' is never used +error CS5001: Program `cs0169.exe' does not contain a static `Main' method +suitable for an entry point + +Expected Results: + +no CS0169 errors. + +Additional Information: + +This could also apply to icalls (i.e. [MethodImplAttribute +(MethodImplOptions.InternalCall)] ). Probably we could just target extern +methods. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
