SCCM 2012 Issue while serializing application object using reflection RRS feed

  • Question

  • Hi,

    I am creating my Application object using reflection with all the necessary objects. In the end, when i invoke SerializeToString with validate arg true using reflection again, i am getting the following error. 

    The element 'Application' in namespace 'http://schemas.microsoft.com/SystemCenterConfigurationManager/2009/AppMgmtDigest' has invalid child element 'DeploymentTypes' in namespace 'http://schemas.microsoft.com/SystemCenterConfigurationManager/2009/AppMgmtDigest'. List of possible elements expected: 'SourceId, DisplayInfo' in namespace 'http://schemas.microsoft.com/SystemCenterConfigurationManager/2009/AppMgmtDigest'.

    Inner exception i am getting is on the SourceId object, 

    Cannot serialize member 'Version' of type System.Nullable`1[System.Int32]. XmlAttribute/XmlText cannot be used to encode complex types.

    Interestingly, if i don't use reflection to construct my object i am not getting any error. Then i compared the serialized xmls from direct approach and reflection approach. I am not finding any difference in them except the Guids. Sometimes, the serialization goes through and sometimes its not. 

    Kindly help me with this.

    • Edited by rchellappan Friday, February 23, 2018 9:35 AM
    • Moved by Stanly Fan Wednesday, February 28, 2018 2:10 AM From ClickOnce
    Friday, February 23, 2018 8:57 AM

All replies

  • Hi rchellappan,

    Sorry for the late reply.

    What the type of your project is? is it a Winform application? Or WPF? UWP?

    >>Cannot serialize member 'Version' of type System.Nullable`1[System.Int32]. XmlAttribute/XmlText cannot be used to encode complex types.

    I found there are some similar questions, please refer to them as below:

    Serializing a Nullable<datetime>in to XML</datetime>

    How to serialize/deserialize a nullable date

    And this forum is discussing and asking questions about ClickOnce and MSI to deploy project, I'm afraid your question is not related to Clickonce, right?



    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 26, 2018 7:31 AM