System::Runtime::Serialization::XsdDataContractExporter::CanExport() broken for C++/CLI in VS2013? - by JL SLO

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


4
0
Sign in
to vote
ID 801795 Comments
Status Closed Workarounds
Type Bug Repros 4
Opened 9/20/2013 5:09:47 PM
Access Restriction Public

Description

Trying to convert some projects from targeting VS2010 toolset to VS2013 came across this issue.  Boiled it down to the code below, where CanExport() will fail.  This code works if I target v110 or v100 instead.  I also rewrote this code in C# and it worked fine.  Pretty sure this prevents all my serialization code to work, so it's pretty blocking.


// ConsoleApplication1.cpp : main project file.

#include "stdafx.h"

using namespace System;
using namespace System::Runtime::Serialization;

[System::Runtime::Serialization::DataContract(Namespace = "http://ata-sd.com")]
public ref class MyState
{
public:
	[System::Runtime::Serialization::DataMember]
	property int i;
};

int main(array<System::String ^> ^args)
{
	XsdDataContractExporter ^exporter = gcnew XsdDataContractExporter();

	if (exporter->CanExport(MyState::typeid)) {
		exporter->Export(MyState::typeid);
	}
	else {
		Console::WriteLine("Error!");
	}

    return 0;
}
Sign in to post a comment.
Posted by JL SLO on 6/5/2014 at 4:46 PM
Hi Karl. I've been testing with the latest update and it seems to be working. Thanks for checking in. Would've loved it if anybody had answered any of the status questions below while it was still broken.
Posted by Microsoft on 6/5/2014 at 3:48 PM
Hi JL SLO,

The fix for this issue has been released in Visual Studio 2013 Update 2. Please upgrade and let us know whether the problem persists. Thanks.

Karl Niu
Visual C++ Team
Posted by ATASLO on 2/14/2014 at 1:22 PM
Still fails when using the following version:

Microsoft Visual Studio Professional 2013
Version 12.0.30110.00 Update 1
Microsoft .NET Framework
Version 4.5.50938

'System.Runtime.Serialization.InvalidDataContractException' occurred in System.Runtime.Serialization.dll

Additional information: Member 'MyState.get_i' cannot be serialized since it is neither a field nor a property, and therefore cannot be marked with the DataMemberAttribute attribute. Remove the DataMemberAttribute attribute from the 'get_i' member.
Posted by rationull on 1/30/2014 at 3:36 PM
Any preview on whether the fix might be released as an update to VS2013 or whether we'll have to wait until the next version?
Posted by JL SLO on 1/30/2014 at 10:56 AM
Think we could get some details on which version it is fixed in?
Posted by JL SLO on 11/15/2013 at 10:24 AM
I ran the above little app through dotPeek and everything seemed the same between the two versions (targeting VS2012, vs VS2013), except in 2013 the getter and setter are declared with a [DataMember] attribute while they are not in VS2012:

VS2012 dotPeek output of MyState.cs:
--------------------------------------------
using System.Runtime.Serialization;

[DataContract(Namespace = "http://ata-sd.com")]
public class MyState
{
private X \u003Cbacking_store\u003Ex;

[DataMember]
public X x
{
    get
    {
     return this.\u003Cbacking_store\u003Ex;
    }
    set
    {
     this.\u003Cbacking_store\u003Ex = value;
    }
}
}

----------------------------

VS2013 dotPeek output of MyState.cs:
-------------------------------------------
using System.Runtime.Serialization;

[DataContract(Namespace = "http://ata-sd.com")]
public class MyState
{
private X \u003Cbacking_store\u003Ex;

[DataMember]
public X x
{
    [DataMember] get
    {
     return this.\u003Cbacking_store\u003Ex;
    }
    [DataMember] set
    {
     this.\u003Cbacking_store\u003Ex = value;
    }
}
}
Posted by JL SLO on 10/22/2013 at 4:53 PM
Just tested on the RTM and it still fails.
Posted by JL SLO on 10/1/2013 at 3:07 PM
Any progress on this?
Posted by Sara [MSFT] on 9/22/2013 at 9:58 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Macy [MSFT] on 9/20/2013 at 5:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)