| Warnings | To correct warning |
| Assemblies should declare minimum security: Microsoft.Usage: No valid permission requests were found for assembly 'ManagedDemo'. You should always specify the minimum security permissions using SecurityAction.RequestMinimum. | -
Add the code using System.Security.Permissions; to the using section of the AssemblyInfo.cs file. -
Next, add the code [assembly:SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode=false)] to the end of the AssemblyInfo.cs file. |
| Mark assemblies with CLSCompliant: Microsoft.Design: 'ManagedDemo' should be marked with the CLSCompliantAttribute, and its value should be true. | -
Add the code using System; to the AssemblyInfo.cs file. -
Next, add the code [assembly: CLSCompliant(true)] to the end of the AssemblyInfo.cs file. -
Rebuild the project. |
| Compiler Warning (level 1) CS3008. | -
Change the name of the field _item to ItemCount. -
Modify public static int item { get { return _item; } } to return ItemCount. -
Rebuild the project. |
| Mark ISerializable types with serializable: Microsoft.Usage: Add a [Serializable] attribute to type 'demo' as this type implements ISerializable. | -
Add the [Serializable ()] attribute to the class demo. -
Rebuild the project. |
| Implement standard exception constructors: Microsoft.Design: Add the following constructor to this class: public demo(String) | |
| Implement standard exception constructors: Microsoft.Design: Add the following constructor to this class: public demo(String, Exception) | |
| Implement standard exception constructors: Microsoft.Design: Add the following constructor to this class: protected demo(SerializationInfo, StreamingContext) | -
Add the code using System.Runtime.Serialization; to the beginning of the Class1.cs file. -
Next, add the constructor protected demo (SerializationInfo info, StreamingContext context) : base(info, context) { } to the class demo. -
Rebuild the project. |
| Implement standard exception constructors: Microsoft.Design: Add the following constructor to this class: public demo() | -
Add the constructor public demo () : base() { } to the class demo. -
Rebuild the project. |
| Identifiers should have correct suffix: Microsoft.Naming: Rename 'testCode.demo' to end in 'Exception'. | |
| Identifiers should be cased correctly: Microsoft.Naming: Correct the casing of namespace name 'testCode' | |
| Identifiers should be cased correctly: Microsoft.Naming: Correct the casing of member name 'item'. | |
| Assemblies should have valid strong names: Sign 'ManagedDemo' with a strong name key. | -
On the Project menu, click ManagedDemo Properties. The project properties appear. -
Click Signing. -
Select the Sign the assembly check box. -
In the Choose a string name key file list, select <New…>. The Create Strong Name Key dialog box appears. -
In the Key file name, type TestKey. -
Enter a password and then click OK. -
On the File menu, click Save Selected Items, and then close the property pages. -
Rebuild the project. |