none
Sonar Qube Code Smell issue Implementation of ISerializable to conform to the recommended serialization pattern RRS feed

  • General discussion

  • Hello,

    How to fix Sonar Qube code smell issue iam getting following issue in IExecption Class 

    1. Update IException Class implementation of 'ISerializable' to conform to the recommended serialization pattern in Iexception.cs

    Please suggest some solution to avoid above error and what is the problem with the code ?

    Thanks,


    /// <summary>
        /// </summary>
        [Serializable]
        public class IException : Exception
        {
            /// <summary>
            /// Error Code
            /// </summary>
            public virtual HttpStatusCode ErrorCode { get; set; }
    
            /// <summary>
            /// Error Description
            /// </summary>
            public virtual string ErrorDescription { get; set; }
        }


    Krishna

    • Changed type Dkrishna Monday, May 7, 2018 8:43 AM
    Monday, May 7, 2018 3:42 AM

All replies

  • I don't remember how to write it right :) But when I create Exception class I create it by Visual Studio - I don't write it manually. So delete your IException class and click generate IException class on place where you want to use IException. 

    IException is bad naming for class. Precedence is that interfaces start with I.

    I think this is article which you need. Creating and Throwing Exceptions (C# Programming Guide)

    Monday, May 7, 2018 3:52 AM