This question is locked. New answers and comments are not allowed.
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
[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
5 Answers, 1 is accepted
0
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.
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.
0
Carsten
Top achievements
Rank 1
answered on 18 Feb 2009, 09:03 AM
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.
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.
0
Hi Carsten,
Is it OK for you if we mark the functions as
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.
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.
0
Carsten
Top achievements
Rank 1
answered on 18 Feb 2009, 03:58 PM
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
Best regards
Carsten
0
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.
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.