<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fredrik Haglund's blog &#187; PageTypeTransfer</title>
	<atom:link href="http://blog.fredrikhaglund.se/blog/tag/pagetypetransfer/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fredrikhaglund.se</link>
	<description>Chatter about EPiServer, ASP.NET, CSS and Web Development.</description>
	<lastBuildDate>Tue, 28 Jun 2011 13:37:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>EPiServer Export, Import or Mirror Troubles?</title>
		<link>http://blog.fredrikhaglund.se/blog/2008/03/28/episerver-export-import-or-mirror-troubles/</link>
		<comments>http://blog.fredrikhaglund.se/blog/2008/03/28/episerver-export-import-or-mirror-troubles/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 16:28:22 +0000</pubDate>
		<dc:creator>Fredrik Haglund</dc:creator>
				<category><![CDATA[EPiServer]]></category>
		<category><![CDATA[Category]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Disassemble]]></category>
		<category><![CDATA[EPiServer 5]]></category>
		<category><![CDATA[Export]]></category>
		<category><![CDATA[Import]]></category>
		<category><![CDATA[Mirror]]></category>
		<category><![CDATA[PageTypeTransfer]]></category>
		<category><![CDATA[PropertyCategoryTransform]]></category>
		<category><![CDATA[TransformCategoryForExport]]></category>

		<guid isPermaLink="false">http://blog.fredrikhaglund.se/blog/2008/03/28/episerver-export-import-or-mirror-troubles/</guid>
		<description><![CDATA[I have been working a lot with migration and mirroring lately using EPiServer&#8217;s functions for export and import of data. My EPiServer Wish list Show call stack when exceptions halt export or import jobs Show PageID and Property related to errors and warnings during import and export This area of the product is still one [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working a lot with migration and mirroring lately using EPiServer&#8217;s functions for export and import of data.</p>
<div class="insert insertright">
<h3>My EPiServer Wish list</h3>
<ul>
<li>Show call stack when exceptions halt export or import jobs</li>
<li>Show PageID and Property related to errors and warnings during import and export</li>
</ul>
</div>
<p>This area of the product is still one of EPiServer weaker areas mainly because the error massages when something goes wrong does not contain enough information.</p>
<p>I want to share the last issue I run into today and also show how I did to find out what was wrong. We could not export and only got this lovely message:</p>
<p><code>The following errors have occurred: Exception: Object reference not set to an instance of an object.[]</code></p>
<p>As you can see not much to go on here&#8230;</p>
<h3>Strategy to resolve issues with EPiServer Export</h3>
<p><a href="http://blog.fredrikhaglund.se/wp-content/uploads/2008/03/image15.png"><img border="0" align="right" width="244" src="http://blog.fredrikhaglund.se/wp-content/uploads/2008/03/image-thumb3.png" alt="image" height="143" style="border-width: 0px" /></a> First thing you should do is to narrow down what is causing our problems and a call stack can often help. 1) We need to attach your debugger to the web server.</p>
<p>2) We must make sure it halts on thrown exceptions even if it outside our code. Open your options dialog and uncheck&#8221;Enable Just My Code&#8221;.</p>
<p><img border="0" align="left" width="244" src="http://blog.fredrikhaglund.se/wp-content/uploads/2008/03/image-thumb4.png" alt="image" height="127" style="border-width: 0px" />With default settings the debugger will only break on uncaught exceptions.</p>
<p>3) We need the debugger to break when an exceptions are thrown regardless of they are handled by a try-catch statement.</p>
<p>This can be changed in your Exceptions dialog (Ctrl+Shift+E). You can either set it to catch all managed exceptions as I have in the screen shot or if you know what exception you are looking for you can halt on that one alone.</p>
<p>We are now ready to start the export again to trigger the error. If everything is correctly configured it will break on the exception and show you a call stack.</p>
<h3>Analyzing the call stack and Disassembling EPiServer</h3>
<p><a href="http://blog.fredrikhaglund.se/wp-content/uploads/2008/03/image16.png"><img border="0" align="right" width="244" src="http://blog.fredrikhaglund.se/wp-content/uploads/2008/03/image-thumb5.png" alt="image" height="176" style="border-width: 0px" /></a>With a call stack we have more clues to go on. In this case the two methods on top of the call stack gives us valuable clues.</p>
<p>Use <em>Lutz Roeder&#8217;s .NET Reflector</em> and click File&gt;Open to load all assemblies in your web applications bin-folder. Search for the class or method and Disassemble the two methods and get more clues.</p>
<p><code>PropertyCategoryTransform.TransformCategoryForExport<br />
PageTypeTransfer.Export</code></p>
<p>In this case it is probable that calling split on <em>categoriesAsIds</em> when <em>categoriesAsIds</em> is null is the culprit.</p>
<p><a href="http://blog.fredrikhaglund.se/wp-content/uploads/2008/03/image17.png"><img border="0" align="left" width="244" src="http://blog.fredrikhaglund.se/wp-content/uploads/2008/03/image-thumb6.png" alt="image" height="148" style="border: 0px" /></a> Looking at the calling method we can see that it is calling <em>TransformCategoryForExport</em> for <em>PageDefinitions</em> (a <em>PageDefinition</em> is another name for a property on a page type) if it as a Category. It does so to convert the Default Value for a Category property into a string with names instead of integer ids.</p>
<h3>Conclusion and workaround</h3>
<p>It is not possible to export a page type if you add a property of type Category selection (in EPiServer CMS 5 RC1 SP1 5.1.422.122). The reason is that default value is null and an easy workaround is to set the default value to &#8220;1&#8243; for each added Category property. The value &#8220;1&#8243; is the root category.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fredrikhaglund.se/blog/2008/03/28/episerver-export-import-or-mirror-troubles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

