Page Type Builder, Base Classes and SharePoint Web Parts

Vote:
 
We have come near to the end of development on a new EPiServer 6 website and it has now been installed into test with Connect for SharePoint 2.2. On the SharePoint side, the standard EPiServer web parts have also been installed. This leads on to the issue we are having.
On both the PageListWebPart and the PageViewWebPart we get the following error message:
"Unexpected error occured. Exception message: There is an error in XML document."
To me, this seems to point towards a serialization issue.
    
We are inheriting from TypedPageData from within PTB for our base class, and then inheriting from our base class in all of the client-specific custom page types. Within the website, this works as expected - no problems. However in SharePoint, we get the error. So I started stripping out and simplifying code in order to find out what the problem was. 
I started my troubleshooting by changing StartPageData class to inherit from TypedPageData directly. Instantly the error within SharePoint was gone for both web parts and they worked correctly. This then lead me to reinstating our custom base class and removing all properties from it - the error came back. So I knew it wasn't anything wrong with the page properties, it's the base class itself.
No matter what I do, it seems to come down to the face that the web parts do not like that I am inheriting from my own page type base class. As I explained, inheriting directly from TypedPageData works correctly.
Has anyone had this problem? Is it something I have possibly missed or is it just not possible due to the restriction of the EPiServer web parts as they are for demonstration only?
----
Just for clarity...
Common base class:
public abstract class PageTypeBase : TypedPageData
{ }
Page type:
public class StartPageData : PageTypeBase
{ }
    
#42895
Sep 06, 2010 14:15
Vote:
 

*come down to the fact* not face... :)

#42896
Sep 06, 2010 14:17
Vote:
 

I'd like to point out that I think this may be a pointless exercise trying to get these web parts working. They just seem to be demo web parts to get developers started and examples of what's available through the web services, and shouldn't be installed live as part of the "Connect for SharePoint" product. (They are like Public Templates to EPiServer CMS?) This may just require me to go back to my project manager to try and force this point home.

Any pointers would be helpful though.

#42907
Sep 06, 2010 15:50
Vote:
 

Hi James!

This all sounds really weird! Could you post some more details about the error (stack trace and anything else you could think of) or e-mail them to me (mail@joelabrahamsson.com)?

#42917
Sep 06, 2010 18:46
Vote:
 

Hi Joel, thanks for getting back to me.

After quite a lot of messing about with serverly slow VPNs, remote desktops and recompiling the EPiServer Web Parts, I've finally got you a useful error... maybe. (See below the break)

Since this error only occurs when I have a base page type class (even with no properties in the base class) it doesn't make much sense. It's definitely serialization as I thought it would be, but it doesn't make it any clearer to why it's happening.

I wouldn't spend any time on this unless you really want to. If you want to replicate my install, all I have is the following:

EPiServer 6.0
SharePoint 2007 (+ SharePoint Connect)

Custom Page Type inheriting from Base Page Type
 - Base Page Type inheriting from TypedPageData (blank class, no 'base' page properties to simplify conditions)

Create a page with the custom page type within the root of the website. Then attempt to browse the page tree with one of the SharePoint web parts.

Removing the base page type and change Custom Page Type to inherit directly from TypedPageData fixes the problem.

 

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

System.InvalidOperationException: There is an error in XML document (1, 99208). ---> System.InvalidOperationException: Instance validation error: 'LinkCollection' is not a valid value for PropertyDataType. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPageStoreService.Read5_PropertyDataType(String s) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPageStoreService.Read7_RawProperty(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPageStoreService.Read9_RawPage(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPageStoreService.Read17_GetChildrenResponse() at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer8.Deserialize(XmlSerializationReader reader) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- End of inner exception stack trace --- at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at EpiServer.SharePointWebParts.PageStoreService.GetChildren(PageReference pageLink, LanguageSelector selector, Int32 startIndex, Int32 maxRows) at EpiServer.SharePointWebParts.WebPartBase.GetChildPages(Int32 parentId)

#42918
Sep 06, 2010 22:10
Vote:
 
#42920
Sep 07, 2010 9:40
Vote:
 

I guess you have a PropertyLinkCollection as one of your properties. That is one of the properties that ToString() is not the underline store string. You can't do ParseToSelf(ToString())

Not looking at your code, it can be that you serilize in the PageTypeBuilder context the value, and when you try to use it it tries to do a ParseToSelf

A

#42921
Sep 07, 2010 9:41
Vote:
 

It seems, Anders, that you are (mostly) correct!

I don't know why I didn't spot this during my testing yesterday, I thought I was getting the error even when I removed all "complex" properties just leaving strings, but my testing was obviously flawed. Today when I remove all instances of the PropertyLinkCollection from my page type, the error does not occur.

Sorry for my misleading results in previous posts, they completely threw me into a completely different line of thought.

 

SO... : I've now done some proper testing and proved that the PropertyLinkCollection is the culprit. To solidify this even further, I started up a new PublicTemplates sample site, modified the content page type adding a PropertyLinkCollection property (within the Admin) then viola - the error appears within SharePoint.

Since I can replicate this without using PageTypeBuilder at all, it doesn't appear to be causing any problems (Joel, you can relax).

This appears to be a problem with any page type (created manually or with PTB) using PropertyLinkCollection.

The error occurs with no custom code (other than to query the web service) so this should be seen as a bug with PropertyLinkCollection, right?

Thanks for your input guys.

#42923
Sep 07, 2010 11:35
Vote:
 

Cool that you found the source of your error

I quess you can make your own propertie and mark all properties with noserilize and have one field that looks something like this. (Haven't tried it thou)

[Serializable]

public string MyValue

{

get

{

return this.SaveData(this.Parent).ToString();

}

set

{

this.LoadData(value);

}

}

#42939
Sep 07, 2010 12:26
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.