FxCop

6 posts, 0 answers
  1. Carsten
    Carsten avatar
    4 posts
    Member since:
    Feb 2009

    Posted 16 Feb 2009 Link to this post

    I get tons of warnings reported by FxCop after enhancing an assembly with OpenAccess ORM. Some examples:

    [Location not stored in Pdb] : warning CA1707 : Microsoft.Naming : Remove all underscores from member 'OpenAccessEnhancedGet_XXX'

    [Location not stored in Pdb] : warning CA1812 : Microsoft.Performance : 'OpenAccessEnhancedModuleInfo' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static methods, consider adding a private constructor to prevent the compiler from generating a default constructor.

    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method BusinessObject.OpenAccessEnhancedCopyFields(Object, Int32[])Void to 'other' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyFields(Object, Int32[])Void.

    Since the code which causes the warnings is being generated while enhancing the assembly, I don't know how to supress these messages.

    Anyone?

    Best regards
    Carsten








  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 17 Feb 2009 Link to this post

    Hello Carsten,
    The first one is because your persistent fields contains these underscores. OpenAccess generates such a method for all your fields and has the exact fieldname as prefix.

    The second will be fixed in the next patch and the third as well.

    Best wishes,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Carsten
    Carsten avatar
    4 posts
    Member since:
    Feb 2009

    Posted 18 Feb 2009 Link to this post

    Hi Jan,

    thanks for your reply. Your explanation about the underscores inside the enhanced code makes sense to me. Since we obey the naming rule "field members start with an underscore", we have to deal with it in some other way.

    I ran another FxCop session. Here is the complete List of warnings (except the underscore messages). I'd apreciate you to handle them all in one your upcoming releases if possible.

    Thanks,
    Carsten

    [Location not stored in Pdb] : warning CA1051 : Microsoft.Design : Make 'OpenAccessEnhancedFlags' private or internal (Friend in VB, public private in C++) and provide a public or protected property to access it.
    [Location not stored in Pdb] : warning CA1051 : Microsoft.Design : Make 'OpenAccessEnhancedStateManager' private or internal (Friend in VB, public private in C++) and provide a public or protected property to access it.
    [Location not stored in Pdb] : warning CA1062 : Microsoft.Design : Validate parameter 'param0' passed to externally visible method EnhancedClass.OpenAccessEnhancedGet_XXX.
    [Location not stored in Pdb] : warning CA1062 : Microsoft.Design : Validate parameter 'param0' passed to externally visible method EnhancedClass.OpenAccessEnhancedProvideFields(Int32[])Void.
    [Location not stored in Pdb] : warning CA1062 : Microsoft.Design : Validate parameter 'param0' passed to externally visible method EnhancedClass.OpenAccessEnhancedReplaceFields(Int32[])Void.
    [Location not stored in Pdb] : warning CA1062 : Microsoft.Design : Validate parameter 'param0' passed to externally visible method EnhancedClass.OpenAccessEnhancedSet_XXX.
    [Location not stored in Pdb] : warning CA1303 : Microsoft.Globalization : EnhancedClass.OpenAccessEnhancedProvideField(Int32)Void passes a literal as parameter 1 of a call to MemberAccessException.MemberAccessException(String). Retrieve the following string argument from a resource table instead 'Internal error struct slot access (provideField_invalidSlotNumber, slot=-1)'
    [Location not stored in Pdb] : warning CA1303 : Microsoft.Globalization : EnhancedClass.OpenAccessEnhancedReplaceField(Int32)Void passes a literal as parameter 1 of a call to MemberAccessException.MemberAccessException(String). Retrieve the following string argument from a resource table instead 'Internal error struct slot access (replaceField_invalidSlotNumber, slot=-1)'
    [Location not stored in Pdb] : warning CA1704 : Microsoft.Naming : Correct the spelling of the unrecognized token 'Memberwise' in member name 'EnhancedClass.OpenAccessEnhancedMemberwiseClone()Object'.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedCopyFields(Object, Int32[])Void to 'other' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyFields(Object, Int32[])Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedCopyKeyFieldsFromObjectId(ObjectIdFieldConsumer, Object)Void to 'fm' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyKeyFieldsFromObjectId(ObjectIdFieldConsumer, Object)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedCopyKeyFieldsToObjectId(Object)Void to 'oid' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyKeyFieldsToObjectId(Object)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedCopyKeyFieldsToObjectId(ObjectIdFieldSupplier, Object)Void to 'fm' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyKeyFieldsToObjectId(ObjectIdFieldSupplier, Object)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedMakeDirty(String)Void to 'fieldName' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedMakeDirty(String)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedNewInstance(StateManager)PersistenceCapable to 'sm' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedNewInstance(StateManager)PersistenceCapable.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedNewInstance(StateManager, Object)PersistenceCapable to 'sm' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedNewInstance(StateManager, Object)PersistenceCapable.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedNewObjectIdInstance(String)Object to 'str' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedNewObjectIdInstance(String)Object.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedProvideField(Int32)Void to 'fieldNumber' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedProvideField(Int32)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedProvideFields(Int32[])Void to 'fieldNumbers' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedProvideFields(Int32[])Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedReplaceField(Int32)Void to 'fieldNumber' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedReplaceField(Int32)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedReplaceFields(Int32[])Void to 'fieldNumbers' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedReplaceFields(Int32[])Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param0' of method EnhancedClass.OpenAccessEnhancedReplaceStateManager(StateManager)Void to 'sm' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedReplaceStateManager(StateManager)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param1' of method EnhancedClass.OpenAccessEnhancedCopyFields(Object, Int32[])Void to 'fieldNumbers' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyFields(Object, Int32[])Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param1' of method EnhancedClass.OpenAccessEnhancedCopyKeyFieldsFromObjectId(ObjectIdFieldConsumer, Object)Void to 'oid' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyKeyFieldsFromObjectId(ObjectIdFieldConsumer, Object)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param1' of method EnhancedClass.OpenAccessEnhancedCopyKeyFieldsToObjectId(ObjectIdFieldSupplier, Object)Void to 'oid' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedCopyKeyFieldsToObjectId(ObjectIdFieldSupplier, Object)Void.
    [Location not stored in Pdb] : warning CA1725 : Microsoft.Naming : Change parameter name 'param1' of method EnhancedClass.OpenAccessEnhancedNewInstance(StateManager, Object)PersistenceCapable to 'oid' in order to match the identifier as it has been declared in PersistenceCapable.OpenAccessEnhancedNewInstance(StateManager, Object)PersistenceCapable.
    [Location not stored in Pdb] : warning CA1802 : Microsoft.Performance : Field 'OpenAccessEnhancedInheritedFieldCount' is declared as 'static readonly' but is initialized with a constant value '0'. Mark this field as 'const' instead.
    [Location not stored in Pdb] : warning CA1802 : Microsoft.Performance : Field 'OpenAccessEnhancedSlotCount' is declared as 'static readonly' but is initialized with a constant value '3'. Mark this field as 'const' instead.
    [Location not stored in Pdb] : warning CA1805 : Microsoft.Performance : EnhancedClass.EnhancedClass() initializes field OpenAccessEnhancedInheritedFieldCount of type System.Int32 to 0. Remove this initialization as it will be done automatically by the runtime.
    [Location not stored in Pdb] : warning CA1812 : Microsoft.Performance : 'OpenAccessEnhancedModuleInfo' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static methods, consider adding a private constructor to prevent the compiler from generating a default constructor.
    [Location not stored in Pdb] : warning CA1823 : Microsoft.Performance : It appears that field 'EnhancedClass.OpenAccessEnhancedSlotCount' is never used or is only ever assigned to. Use this field or remove it.

  5. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 18 Feb 2009 Link to this post

    Hi Carsten,
    Is it OK for you if we mark the functions as

    CompilerGenerated

    ? Because at the end that is true.

    All the best,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Carsten
    Carsten avatar
    4 posts
    Member since:
    Feb 2009

    Posted 18 Feb 2009 Link to this post

    Exactly. Let's give it a try. Can you notify me (e. g. post a reply here) upon realease of the modified version?

    Best regards
    Carsten
  7. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 18 Feb 2009 Link to this post

    Hi Carsten,
    It will be in the next patch build on friday, available latest on monday if everything works.

    Greetings,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner