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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:25:39+00:00 2026-06-01T22:25:39+00:00

public static class Constants { public const string Fields_Fax = FAX; public const string

  • 0
public static class Constants
{

    public const string Fields_Fax = "FAX";
    public const string Fields_DataProtectionPost = "DATAPROTECTIONPOST";
    public const string Fields_DataProtectionTel = "DATAPROTECTIONMOBILE";        
    public const int AddressBookID = 595204;

    public static readonly XName PersonXName = "Person";

This class is in a window service solution. The service was installed locally and was running using the values above.

I took over the project and added some static readonly XName types of my own to this class.
Now I get an error “The type initializer for ‘This.App’ threw an exception” when i use any property from that class.

There is only 1 project and I’ve recompiled solution and reinstalled the window service. Any idea what the problem is?

The exception is:

"The type initializer for 'Constants' threw an exception"

…the inner exception is:

"The ' ' character, hexadecimal value 0x20, cannot be included in a name."

…I commented out my changes and it was reading correctly with no errors. So I added just 1 line which looks similar to the “Person” constant but caused it to fail:

public static readonly XName cor_Tel_GeneralXName = "Tel General";
  • 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-01T22:25:41+00:00Added an answer on June 1, 2026 at 10:25 pm

    XName is used as an XML node, and so is subject to the usual restrictions for naming XML nodes. You can’t have a space in the name of an XML node.

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

Sidebar

Related Questions

class Interface { public: static const int i = 1; static const double d
public class Sample{ private const =constant string; public static object StaticMethod(args){ var result= SomeOtherClass.StaticMethod(const,args);
I have something like this : class ParentClass { public static const ON_SOME_EVT:String =
Why there are two Color constants defined in java.awt.Color class? For instance public static
I have public static class A { public static string ConnString; } [Serializable] public
I've got the following class: public static class Pages { public static string LoggedOut
What's wrong with using nested classes to group constants? Like so: public static class
I am trying to set some public static constants on a class conditionally by
I have this code; using System; namespace Rapido { class Constants { public static
I need to implement this: static class MyStaticClass { public const TimeSpan theTime =

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.