Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. unable to reflect type

unable to reflect type

Scheduled Pinned Locked Moved C#
helpquestioncsharpsysadminsecurity
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    p daddy
    wrote on last edited by
    #1

    I've got a problem with the XmlSerializer - i can't seem to serialiaze custom types. The XmlSerializer works fine with any BCL type, but my custom types throw this error: An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error reflecting 'ComponentTestConsole.CustomType'. I wonder if it's a security thing (even though it's not a security exception), since this is the first project i've created on a network drive and it did warn me when i started the project yesterday. So as a second question, what do i need to do to let .NET know that my network shares are safe as houses? :confused: Thanks in advance, Paul

    F A 2 Replies Last reply
    0
    • P p daddy

      I've got a problem with the XmlSerializer - i can't seem to serialiaze custom types. The XmlSerializer works fine with any BCL type, but my custom types throw this error: An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error reflecting 'ComponentTestConsole.CustomType'. I wonder if it's a security thing (even though it's not a security exception), since this is the first project i've created on a network drive and it did warn me when i started the project yesterday. So as a second question, what do i need to do to let .NET know that my network shares are safe as houses? :confused: Thanks in advance, Paul

      F Offline
      F Offline
      FruitBatInShades
      wrote on last edited by
      #2

      Have you implemented the serializable interface in your classes?

      P 1 Reply Last reply
      0
      • F FruitBatInShades

        Have you implemented the serializable interface in your classes?

        P Offline
        P Offline
        p daddy
        wrote on last edited by
        #3

        Hi Lee, I was just about to post to say i've fixed it. I hadn't looked in the InnerException member of the thrown exception - i'd stupidly not made my custom type public (doh!). You don't need to implement the serializable interface to use the XmlSerializer - it uses reflection to inspect the type and serialize any publicly accessible members. Cheers, Paul

        1 Reply Last reply
        0
        • P p daddy

          I've got a problem with the XmlSerializer - i can't seem to serialiaze custom types. The XmlSerializer works fine with any BCL type, but my custom types throw this error: An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error reflecting 'ComponentTestConsole.CustomType'. I wonder if it's a security thing (even though it's not a security exception), since this is the first project i've created on a network drive and it did warn me when i started the project yesterday. So as a second question, what do i need to do to let .NET know that my network shares are safe as houses? :confused: Thanks in advance, Paul

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          I beleive that the xml serializer requires the class to have a public parameter-less constructor. Does yours have one?

          P 1 Reply Last reply
          0
          • A Anonymous

            I beleive that the xml serializer requires the class to have a public parameter-less constructor. Does yours have one?

            P Offline
            P Offline
            p daddy
            wrote on last edited by
            #5

            Thanks, but i've fixed it now. see post above.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups