<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Writing Complex String Literals</title>
	<link>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Tue, 06 Jan 2009 12:57:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.3</generator>

	<item>
		<title>by: Sune</title>
		<link>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-82</link>
		<pubDate>Sun, 26 Nov 2006 22:19:25 +0000</pubDate>
		<guid>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-82</guid>
					<description>Hi Kristian and Olav.

The method described works regardless of whether the source code is available. It relies on auto-generating an xml documentation file.

Regarding release builds -- I think I know what Olav is doing, but correct me if I'm wrong. The method does actually work in release, but you have to keep a few things in mind. As you pointed out, an optimized stack is a problem (at least for the implementation we came up with). To overcome that issue I see two options.

Introduce [MethodImpl(MethodImplOptions.NoInlining)] in your code, to ensure that methods are not inlined, thus making the stack layout predictable.

Or (maybe even better?), don't build your tests in release config. Instead, build your app. code in debug and release, and your test code in debug only. Of course you can still run your debug tests against both debug and release versions of your app.

Using the last approach will give you a predictable stack, and hey... Release config means that the executable should be optimized using inlining, stripping debug info etc. Why would you ever compile your tests without debugging info? :-)

I agree that most people builds the app code in two configurations, and they usually do the same with the test code. But I honestly think that instead of running release tests against a release app, what you really want is to run debug tests against a release config of your app.

Just my two cents...</description>
		<content:encoded><![CDATA[<p>Hi Kristian and Olav.</p>
<p>The method described works regardless of whether the source code is available. It relies on auto-generating an xml documentation file.</p>
<p>Regarding release builds &#8212; I think I know what Olav is doing, but correct me if I&#8217;m wrong. The method does actually work in release, but you have to keep a few things in mind. As you pointed out, an optimized stack is a problem (at least for the implementation we came up with). To overcome that issue I see two options.</p>
<p>Introduce [MethodImpl(MethodImplOptions.NoInlining)] in your code, to ensure that methods are not inlined, thus making the stack layout predictable.</p>
<p>Or (maybe even better?), don&#8217;t build your tests in release config. Instead, build your app. code in debug and release, and your test code in debug only. Of course you can still run your debug tests against both debug and release versions of your app.</p>
<p>Using the last approach will give you a predictable stack, and hey&#8230; Release config means that the executable should be optimized using inlining, stripping debug info etc. Why would you ever compile your tests without debugging info? <img src='http://www.chrylers.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I agree that most people builds the app code in two configurations, and they usually do the same with the test code. But I honestly think that instead of running release tests against a release app, what you really want is to run debug tests against a release config of your app.</p>
<p>Just my two cents&#8230;
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Olav</title>
		<link>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-80</link>
		<pubDate>Fri, 24 Nov 2006 08:01:59 +0000</pubDate>
		<guid>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-80</guid>
					<description>Kristian, 
it doesn't work if the code is optimized. Then the stack/frame stuff is not reliable.
Check the remarks section here http://msdn2.microsoft.com/en-us/library/system.diagnostics.stacktrace.aspx  .

I think unit testing of optimized code is important as well.</description>
		<content:encoded><![CDATA[<p>Kristian,<br />
it doesn&#8217;t work if the code is optimized. Then the stack/frame stuff is not reliable.<br />
Check the remarks section here <a href='http://msdn2.microsoft.com/en-us/library/system.diagnostics.stacktrace.aspx' rel='nofollow'>http://msdn2.microsoft.com/en-us/library/system.diagnostics.stacktrace.aspx</a>  .</p>
<p>I think unit testing of optimized code is important as well.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: kristian</title>
		<link>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-79</link>
		<pubDate>Thu, 23 Nov 2006 16:52:25 +0000</pubDate>
		<guid>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-79</guid>
					<description>Hi Olav,

right, it doesn't work unless the source code is available which causes some obvious limitations. However, for unit testing the concept works quite fine.</description>
		<content:encoded><![CDATA[<p>Hi Olav,</p>
<p>right, it doesn&#8217;t work unless the source code is available which causes some obvious limitations. However, for unit testing the concept works quite fine.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Olav</title>
		<link>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-78</link>
		<pubDate>Thu, 23 Nov 2006 15:55:00 +0000</pubDate>
		<guid>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-78</guid>
					<description>you should not that the method described by Lars Thorup does not work in release builds, which in my opinion makes it useless</description>
		<content:encoded><![CDATA[<p>you should not that the method described by Lars Thorup does not work in release builds, which in my opinion makes it useless
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: kristian</title>
		<link>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-26</link>
		<pubDate>Sun, 23 Jul 2006 07:03:36 +0000</pubDate>
		<guid>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-26</guid>
					<description>Hi Thomas,

you are right - I did not realize this. Thank you</description>
		<content:encoded><![CDATA[<p>Hi Thomas,</p>
<p>you are right - I did not realize this. Thank you
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Thomas Eyde</title>
		<link>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-25</link>
		<pubDate>Sat, 22 Jul 2006 23:35:37 +0000</pubDate>
		<guid>http://www.chrylers.com/2006/07/22/writing-complex-string-literals/#comment-25</guid>
					<description>C# strings with @ can be multiline. But you're right about they can't contain quotation marks.</description>
		<content:encoded><![CDATA[<p>C# strings with @ can be multiline. But you&#8217;re right about they can&#8217;t contain quotation marks.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
