Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6861335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:31:18+00:00 2026-05-27T02:31:18+00:00

I completed coding my application. But when I click start button, my app raised

  • 0

I completed coding my application. But when I click start button, my app raised a exceptions.. :'(

A first chance exception of type 'System.Runtime.Serialization.InvalidDataContractException' occurred in System.Runtime.Serialization.dll
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
A first chance exception of type 'System.Runtime.Serialization.InvalidDataContractException' occurred in System.Runtime.Serialization.dll

So I saw argument e of ‘Application_UnhandledException’, and I could know the reason.
“‘Type ‘GPACalculator.Subject’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.”

I just make my class using default data types..

public class Subject : INotifyPropertyChanged
{
    private string name;
    private GradePoint gradePoint;
    private int credit;

    public Subject(string name)
    {
        Name = name;
        GradePoint = new GradePoint();
    }

    public string Name
    {
        get { return name; }
        set
        {
            Debug.WriteLine("Name: " + value);
            if (name != value)
            {
                name = value;
                OnPropertyChanged("Name");
            }
        }

    }

    public GradePoint GradePoint
    {
        get { return gradePoint; }
        set
        {
            if (gradePoint != value)
            {
                gradePoint = value;
                OnPropertyChanged("GradePoint");
            }
        }
    }

    public int Credit
    {
        get { return credit; }
        set
        {
            if (credit != value)
            {
                credit = value;
                OnPropertyChanged("Credit");
            }
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
    private void OnPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}


public class GradePoint : INotifyPropertyChanged
{
    private string mainGradePoint;
    private string subGradePoint;
    private int credit;

    public int Credit
    {
        get { return credit; }
        set
        {
            if (credit != value)
            {
                credit = value;
                OnPropertyChanged("Credit");
            }
        }
    }

    public string MainGradePoint
    {
        get { return mainGradePoint; }
        set
        {
            value = value.ToUpper();
            if (mainGradePoint != value)
            {
                mainGradePoint = value;
                OnPropertyChanged("MainGradePoint");
            }
        }
    }

    public string SubGradePoint
    {
        get { return subGradePoint; }
        set
        {
            if (subGradePoint != value)
            {
                subGradePoint = value;
                OnPropertyChanged("SubGradePoint");
            }
        }
    }

    public override string ToString()
    {
        return string.Format("{0}{1}", mainGradePoint, subGradePoint);
    }

    public double ToDouble(double perfectScore = 4.5F)
    {
        double gap = perfectScore - Math.Floor(perfectScore);
        double value;


        switch (mainGradePoint)
        {
            case "A":
                value = 4.0;
                break;
            case "B":
                value = 3.0;
                break;
            case "C":
                value = 2.0;
                break;
            case "D":
                value = 1.0;
                break;
            default:
                value = 0.0;
                return value;
        }

        switch (subGradePoint)
        {
            case "+":
                value += gap;
                break;
            case "-":
                value -= gap;
                break;
        }

        return value;
    }

    public event PropertyChangedEventHandler PropertyChanged;
    private void OnPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}

The above is my class..

please help me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:31:18+00:00Added an answer on May 27, 2026 at 2:31 am

    Start by decorating your classes with the appropriate attributes for the serializer you want to use, e.g. [Serializable] for BinaryFormatter, or [DataContract] for contract based formatters.

    Note: If you use the [Serializable] attribute, remember to mark the event fields with [field:NonSerialized] otherwise all the listeners of those events will be serialized as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i just completed a web based chat application based on ajax/php. But the problem
I start coding a small qt application to compute checksums. After the unthreaded code
First off, I'm a complete beginner at C++. I'm coding something using an API,
I've finally completed a working version of my first ever CSS-supported site (thanks to
I've successfully completed a Windows Forms application with MS Word integration - the application
I have completed every step in XMonad's tutorial for Mac. However, I cannot start
I've just completed my user photo album feature in my application and images upload
Thanks to Stack Overflow and you guys i successfully completed my first project (viz.
So, we were coding an Android application in Eclipse, and we couldn't figure out
I am trying to start activity at start up of phone but whole program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.