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

  • Home
  • SEARCH
  • 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 5996809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:10:35+00:00 2026-05-23T00:10:35+00:00

I ran into problems when trying to xml serialize a class to xml after

  • 0

I ran into problems when trying to xml serialize a class to xml after I changed it from public to internal. Before I changed protection level it was working fine, so I am looking for a way to get around the public only restriction.

The reason I want it to be internal is that I moved the class into a library and it’s not useful outside the library.

A simple example of class layout:

[Serializable]
internal class InternalSerializable
{
    [XmlAttribute]
    public int Foo = 5;

    public InternalSerializable()
    {
    }
}

Normally XmlSerializer is automatically generated and have a random assembly name, so I tried using sgen.exe to pre-generate the XmlSerializer and reference it using:

[assembly: InternalsVisibleTo("FileFormats.XmlSerializers")]

but when running sgen with /verbose switch it says that only public types can be processed.

So I was wondering if anyone know how to trick sgen into processing internal types or otherwise serialize internal classes?

Edit: I got quite a few classes with this problem so I would prefer not to rewrite the whole thing

  • 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-23T00:10:35+00:00Added an answer on May 23, 2026 at 12:10 am

    Hackish but you could make your class public and mark it with EditorBrowsable attribute to hide it from intellisense.

    [EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
    [Serializable]
    public class InternalSerializable
    

    In C#, EditorBrowsable work only on compiled assemblies : Hiding GetHashCode/Equals/ToString from fluent interface classes intellisense in Visual Studio for C#?

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

Sidebar

Related Questions

I ran into a problem while trying to parse an XML string returned from
while trying to deploy a Grails application into tomcat6 I ran into some problems:
I quickly ran into problems when trying to create an ActiveRecord instance that overrode
I've ran into a problem while trying to test following IRepository based on NHibernate:
I know this question has been asked before, but I ran into a problem.
Decided to move one of my project from iBatis to MyBatis and ran into
I'm learning about how to use config files and I ran into some problems
Hey there! I'm trying to serialize data in AS3 but am running into a
I ran into this problem when trying to add rounded corners to some divs
im currently learning jQuery and have ran into a problem. I am trying to

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.