?
Solved

XmlSerializer(this.GetType());

Posted on 2013-06-12
3
Medium Priority
?
246 Views
Last Modified: 2013-06-14
I've shot myself in the foot...

I've been cleaning up a project and I've made a few changes...

I'm trying to run a test and I call...

XmlSerializer Serializer = new XmlSerializer(this.GetType());

and I get...
System.InvalidOperationException was unhandled
  Message=There was an error reflecting type 'MyProjects.MyProject.SchemaObjectCollection'.
  Source=System.Xml
  StackTrace:
       at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)

In an effort to make the problem resolve, I replaced the code in SchemaObjectCollection with the version before I created this problem. I've reverted several other files as well and I'm I bit stuck.

I'm probably giving insufficient information for help, but I thought I'd ask.

Thanks in advance for trying!
0
Comment
Question by:gswitz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 36

Assisted Solution

by:Miguel Oz
Miguel Oz earned 1000 total points
ID: 39246232
Please post this.GetType() return value.

Then check that your class (defined in this value) is serializable (or has public properties) and have a parameterless constructor:
http://msdn.microsoft.com/en-us/library/182eeyhh%28VS.71%29.aspx
For further troubleshooting details:
http://msdn.microsoft.com/en-us/library/aa302290.aspx

If you need more help plese post your class declaration.
0
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 1000 total points
ID: 39248453
Does your MyProjects.MyProject.SchemaObjectCollection object has a parameterless constructor?
0
 

Author Closing Comment

by:gswitz
ID: 39248855
Thanks folks. I ran after the wrong class because I hadn't checked the inner exception. Once I was on to the right class the fix was easy.

Thanks!!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question