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 7863513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:30:16+00:00 2026-06-02T23:30:16+00:00

For years, I’ve been following MS best practices on how to write a custom

  • 0

For years, I’ve been following MS best practices on how to write a custom exception class (don’t even remember if it was first enforced by FxCop or by an article I read) and wrote my classes the following way:

using System;
using System.Runtime.Serialization;

[Serializable]
public sealed class MyGreatException : Exception
{
  public MyGreatException()
  : base() {}

  public MyGreatException(string message)
  : base(message) {}

  public MyGreatException(string message, Exception inner)
  : base(message, inner) {}

  private MyGreatException(SerializationInfo info, StreamingContext context)
  : base(info, context) {}
}

Today these classes get rejected by Windows 8 App Cert Kit:

 .API System.Runtime.Serialization.SerializationInfo in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. com.visionobjects.myscript.hwr.dll calls this API.
 .API System.SerializableAttribute in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. com.visionobjects.myscript.hwr.dll calls this API.

(among other rejects…)

So now that it’s 2012, how do I write a custom exception class? Do I just have to remove [Serializable] and the private constructor supposed to deal with custom serialization (which I don’t need anyway)?


EDIT

I removed [Serializable] and the private constructor. I guess that makes my custom exception class non serializable. As this is a class exposed by a class library, how does that impact the code using the library?

  • 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-06-02T23:30:17+00:00Added an answer on June 2, 2026 at 11:30 pm

    It doesn’t look like System.Runtime.Serialization.SerializationInfo is supported yet in the Metro-compatible version of the .NET framework. See http://msdn.microsoft.com/en-us/library/windows/apps/hh454059(v=vs.110).aspx for details about which classes they’re choosing to support from the System.Runtime namespace. Keep in mind, this is subject to change.

    So yes, take out your Serialization attribute and the private constructor.

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

Sidebar

Related Questions

For years I have been using the DEBUG compiler constant in VB.NET to write
For years I've been following a great pattern called Target-Action which goes like this:
For years now I've been using a chat that has the following code to
For years I have been using the following pattern to remove duplicates from an
For years, maybe 10, I've been fascinated with cryptography. I read a book about
Several years back, I innocently tried to write a little app to save my
For years I've been using ShellExecute() API to launch the default web browser from
For years I've been reading about XML and I have just not quite grokked
Years back I built a simple mail form that has been working like a
Many years back, I was told that Javascript was harmful, and I remember being

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.