<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.simple-talk.com/community/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Alex Davies</title><link>http://www.simple-talk.com/community/blogs/alex/default.aspx</link><description>Software Engineer - Red Gate Software</description><dc:language>en-GB</dc:language><generator>CommunityServer 2.0 (Build: 60217.2664)</generator><item><title>A new toy - .NET Demon</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2012/01/16/105463.aspx</link><pubDate>Mon, 16 Jan 2012 16:17:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:105463</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/105463.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=105463</wfw:commentRss><description>&lt;p&gt;I'd like to present a new tool for .NET Developers that we've been cooking up in the Red Gate .NET team. It's only a beta at the moment, but it works for most people.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.red-gate.com/products/dotnet-development/dotnet-demon/"&gt;.NET Demon Beta&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It's a Visual Studio extension that cuts the time you spend waiting to find whether your code is right. It does this by:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Continuous testing (running your NUnit tests as you type)&lt;/li&gt;    &lt;li&gt;Continuous compilation (so you can start running instantly because your code is already compiled)&lt;/li&gt;    &lt;li&gt;Inline code coverage (so you know which tests are covering the code you're editing, and if they start failing)&lt;/li&gt;    &lt;li&gt;Continuous save (so you don't have to press ctrl-S ever again)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Let me know what you think of it!&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=105463" width="1" height="1"&gt;</description></item><item><title>SmartAssembly Sync for JIRA</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2011/05/12/101554.aspx</link><pubDate>Thu, 12 May 2011 12:59:02 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:101554</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>2</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/101554.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=101554</wfw:commentRss><description>&lt;p&gt;JIRA is a powerful bug &lt;i&gt;tracking&lt;/i&gt; system, but it can't help you to actually collect error reports from your users. For that we've started using &lt;a href="http://www.red-gate.com/products/dotnet-development/smartassembly/?utm_source=simpletalk&amp;amp;utm_medium=blog&amp;amp;utm_content=sasync&amp;amp;utm_campaign=smartassembly"&gt;SmartAssembly&lt;/a&gt; (SA), but we quickly realised that there was no easy (or, more importantly, automatic) way to get error reports &lt;i&gt;out&lt;/i&gt; of SA and into JIRA.&lt;/p&gt;  &lt;h4&gt;Automation is the Mother of Invention&lt;/h4&gt;  &lt;p&gt;David Simner, Ben Challenor and I got together in one of our regular &lt;a href="http://vimeo.com/11075477"&gt;Down-Tools weeks&lt;/a&gt; to see if we could do something to ease the pain of importing error reports into JIRA. SA had an SDK, and JIRA had a SOAP API, so we automated!&lt;/p&gt;  &lt;p&gt;Given that we were all already users of both systems, we knew how we liked to handle bugs and error reports, and wanted to make sure we supported those processes. So, after 4 days of intensive coding and testing, &lt;a href="http://sasync.codeplex.com/"&gt;SmartAssembly Sync for JIRA&lt;/a&gt; was born. We started using it in our own teams, and before long the rest of Red Gate were clamouring to have it set it for them as well.&lt;/p&gt;  &lt;p&gt;The other teams really appreciated the way that duplicate bug reports are grouped together (letting them see how many people had hit specific issues). Combined with all the other information that our tool provided, and JIRA's powerful searching, prioritisation was a piece of cake.&lt;/p&gt;  &lt;h4&gt;What's going on under the hood?&lt;/h4&gt;  &lt;p&gt;What the tool actually does is fairly obvious if you know how JIRA and SA work - we just put all the pieces together. Without going into too much gory detail, here's the whole process that SmartAssembly Sync for JIRA runs through every 10 minutes on a scheduled task:&lt;/p&gt;  &lt;p&gt;First, it makes SA download any new reports. Then it connects to your JIRA server, and downloads its configuration (which is stored as special "SA Project Link" issues in JIRA so anyone can configure it easily).&lt;/p&gt;  &lt;p&gt;For each report it downloaded, it does the following:&lt;/p&gt;  &lt;p&gt;a. It looks to see if the bug is already in JIRA. &lt;/p&gt;  &lt;p&gt;b. If it &lt;i&gt;isn't:&lt;/i&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;i. It opens a new JIRA issue;&lt;/p&gt;    &lt;p&gt;ii. If the report is from some library code that is used by more than one product, it opens another JIRA issue in the JIRA project for the appropriate library, and links the two.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;c. If the bug is already in JIRA:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;i. It comments on the existing JIRA issue&lt;/p&gt;    &lt;p&gt;ii. If the JIRA issue is marked as resolved or closed, and the report is from a later version, the issue is re-opened;&lt;/p&gt;    &lt;p&gt;iii. It updates several fields in JIRA as necessary, such as the earliest version seen, latest version seen, report count, etc.;&lt;/p&gt;    &lt;p&gt;iv. If all your systems are set up appropriately, it can send an auto-email to the customer who sent the report (assuming they gave an email address).&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;It then has some pretty excessive extra features. For example you can configure it so that if a report is from some shared library code, it'll open a second JIRA issue in the JIRA project for the library, and link the two.&lt;/p&gt;  &lt;p&gt;Once you've got it working, the tool automatically categorizes reports that are probably the same bug (by the type and location of the exception) providing everything that's specific to the bug (i.e. stack trace, exception type) in the description. Then each report becomes a comment on the bug, including all the per-report information (i.e. build number, email address, etc.).&lt;/p&gt;  &lt;p&gt;All in all, I think the tool is cool, and I know Ben and David do too. It's also some of the nicest code I've been involved in writing, which is lucky, because we've decided to open-source it :)&lt;/p&gt;  &lt;h4&gt;Making the most of your error reports&lt;/h4&gt;  &lt;p&gt;Anyone who uses &lt;a href="http://www.red-gate.com/products/dotnet-development/smartassembly/error-reporting/?utm_source=simpletalk&amp;amp;utm_medium=blog&amp;amp;utm_content=sasync&amp;amp;utm_campaign=smartassembly"&gt;SmartAssembly error reporting&lt;/a&gt; will benefit from this tool, as it will completely remove the need to manually import issues into JIRA, which is potentially a huge time-sink. Quite apart from the time-sink, most developers will probably find that tracking bugs in two different places also makes it easy to forget about the SmartAssembly reports, which is going to mean their software ends up lower quality, which is bad for everyone.&lt;/p&gt;  &lt;p&gt;It'd be great if you could &lt;a href="http://sasync.codeplex.com/"&gt;take SmartAssembly Sync for a spin&lt;/a&gt;, and let us know what you think :)&lt;/p&gt;  &lt;p&gt;If your bug-tracking system isn't JIRA, SmartAssembly Sync is written very modularly, and it should be very easy to modify to work with any other bug-tracking system with a decent API. I'd really appreciate hearing from you if you try this, especially if you're willing to share your code!&lt;/p&gt;  &lt;p&gt;You can find out more on the &lt;a href="http://blogs.atlassian.com/jira/2011/04/error-reporting-tracking-and-communication-with-smartassembl.html"&gt;JIRA blog&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=101554" width="1" height="1"&gt;</description></item><item><title>Exploring Windows Azure - is it more than just hosting?</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2011/03/27/100983.aspx</link><pubDate>Sun, 27 Mar 2011 14:52:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:100983</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/100983.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=100983</wfw:commentRss><description>&lt;p&gt;Recently, I've been working on a side project in my spare time. It's a little facebook app to help you remember how much money you owe your friends:&lt;/p&gt;

&lt;p&gt;Visit my app: &lt;a href="http://totup.mobi"&gt;ToTuP&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since the cloud seems so fashionable at the moment I thought I'd give Microsoft's &lt;a href="http://www.microsoft.com/windowsazure/"&gt;Azure&lt;/a&gt; infrastructure a bit of a test, by running my app on it. Of course, I'm very keep to have the easy management and scalability that a cloudy system offers, but is it extra effort, and is that effort worth it?&lt;/p&gt;

&lt;p&gt;I've previously tried Google's &lt;a href="http://code.google.com/appengine/"&gt;App Engine&lt;/a&gt;, and I assumed that Azure would be much the same, but in a lot of ways it's more like &lt;a href="http://aws.amazon.com/ec2/"&gt;Amazon EC2&lt;/a&gt;, which just gives you full access to virtual machines.&lt;/p&gt;

While Azure shares App Engine's easy deployment with IDE integration, that's more or less where the similarity stops:
&lt;ul&gt;
&lt;li&gt;
Whereas App Engine just promises that there will be some computers somewhere running your web service, Azure asks you to specify how many instances to create, and which continent they should be on
&lt;/li&gt;
&lt;li&gt;
App Engine's pricing model charges you for the CPU cycles that you use, but Azure charges you for the virtual machines that you have running, even if they're idle
&lt;/li&gt;
&lt;li&gt;
The important downside of App Engine, that allows it to run in this way, is that you are heavily restricted in what features of the JVM you are allowed to use. While this should be fine for new apps, it gets in the way of porting existing apps to the cloud, and I found that the MVC framework I was using made use of the disallowed features. Azure on the other hand makes no restrictions. While the IDE deploy is designed for .NET apps, I'm led to believe that you can run pretty much anything on Azure instances.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A big problem for cloud services is the developer's need to debug problems that happen in the cloud environment that weren't present in development. Azure provides a "local app fabric" to mitigate this, but I found it no more likely to find bugs than just running in local IIS. Luckily, Microsoft (probably grudginly) recognised this, and enabled remote desktop access to the virtual machines. Now I can do whatever I need actually on the cloud machine (including running &lt;a href="http://www.red-gate.com/products/dotnet-development/dotnet-developer-bundle/"&gt;ANTS Performance Profiler&lt;/a&gt; after making a small fix to it which you can get from Red Gate Support if you need).&lt;/p&gt;

&lt;p&gt;So, in summary, I'm a bit disappointed that the technology isn't as cool as Google's, which means that I have to pay for virtual machines that are doing nothing most of the time. But in exchange, I have the ability to debug in my hosting environment in a way that just doesn't make sense in App Engine. A tough call, and the only reason I know I'd use Azure again is that I like C# a lot more than java :)&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=100983" width="1" height="1"&gt;</description></item><item><title>Automated testing in Silverlight with Statlight</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/09/21/94575.aspx</link><pubDate>Tue, 21 Sep 2010 12:24:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:94575</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/94575.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=94575</wfw:commentRss><description>&lt;p&gt;I really like automated testing. Not just on any kind of religious basis, it just saves loads of time. I think it's best when the tests run automatically on or after each build.&lt;/p&gt;  &lt;p&gt;So I was disappointed to find that there isn't a way provided with the Silverlight framework to run tests for Silverlight applications. Silverlight is different enough to normal .NET that you can't just use NUnit or similar, and run the tests on the desktop CLR. There are a couple of unit testing frameworks, but you have to invoke them from inside a browser. No running on the command line for my automated builds.&lt;/p&gt;  &lt;p&gt;After some digging I found this little-known app called Statlight, which exactly fills the gap:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://statlight.codeplex.com/"&gt;http://statlight.codeplex.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You pass it the location of a .xap file on the command line, and it will run any tests it finds within (MSBuild and NUnit's Silverlight flavours, among others, are supported).&lt;/p&gt;  &lt;p&gt;The only trouble is that it has to open a dummy browser window in which to host the Silverlight runtime. The window is hidden, but you can't run the tests as a service which doesn't have permission to display user interfaces. There's no easy way of getting around this (when you want to run the tests under a domain account) so I ended up running my copy of CruiseControl.NET via the "Startup" folder in the start menu, and using &lt;a href="http://support.microsoft.com/kb/315231/en-gb"&gt;automatic logon&lt;/a&gt; to get it up and running automatically after a reboot. Icky.&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=94575" width="1" height="1"&gt;</description></item><item><title>Automated Error Reporting in .NET Reflector - harnessing the most powerful test rig in existence</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/06/17/93078.aspx</link><pubDate>Thu, 17 Jun 2010 17:23:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:93078</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>2</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/93078.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=93078</wfw:commentRss><description>&lt;p&gt;I know a testing system that will find more bugs than all the unit testing, integration testing, and QA you could possibly do. And the chances are you're not using it.&lt;/p&gt;  &lt;p&gt;It's called your users.&lt;/p&gt;  &lt;p&gt;It's a cliché that you should test so that you find your bugs rather than your users. Of course you should. But it's also a cliché that no software is ever shipped bug-free. Lost cause? No, opportunity!&lt;/p&gt;  &lt;p&gt;I think .NET Reflector 6 is pretty stable. In fact I know exactly how stable it is, because some (surprisingly high) proportion of its users tell me every time it crashes:&lt;/p&gt;  &lt;p&gt;&lt;a href="/blogbits/Alex_Davies/Aut.NETReflectorharnessingthemostpowerfu_E5D2/image.png"&gt;&lt;img title="image" border="0" alt="image" src="/blogbits/Alex_Davies/Aut.NETReflectorharnessingthemostpowerfu_E5D2/image_thumb.png" width="433" height="288" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If they press "Send Error Report", I get:&lt;/p&gt;  &lt;p&gt;&lt;a href="/blogbits/Alex_Davies/Aut.NETReflectorharnessingthemostpowerfu_E5D2/image_3.png"&gt;&lt;img title="image" border="0" alt="image" src="/blogbits/Alex_Davies/Aut.NETReflectorharnessingthemostpowerfu_E5D2/image_thumb_3.png" width="504" height="581" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And then I fix it. As a rough guess, while a standard stack trace is enough to fix a problem 30% of the time, having all those local variables in the stack trace means I can fix it about 80% of the time.&lt;/p&gt;  &lt;p&gt;How does this all happen? Did it take ages to code this swish system? Nope, it was one checkbox in SmartAssembly. It adds some clever code to your assembly to capture local variables every time an exception is thrown, and to ask your user to report it to you, with a variety of other useful information.&lt;/p&gt;  &lt;p&gt;Of course not all bugs show up as exceptions. But if you get used to knowing that SmartAssembly will tell you when an exception happens, you begin to change your coding style. Now, as long as an exception gets thrown in any situation you don't expect, you'll fix it if it ever happens. You'll start throwing exceptions liberally, and stop having to think about whether tiny edge cases are possible, as long as they throw an exception if they happen.&lt;/p&gt;
&lt;p&gt;You can try this out for yourself by downloading the &lt;a href="http://www.red-gate.com/products/smartassembly/index.htm?utm_source=simpletalk&amp;utm_medium=blog&amp;utm_content=sa5release-alex&amp;utm_campaign=smartassembly"&gt;free trial of SmartAssembly&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=93078" width="1" height="1"&gt;</description></item><item><title>Why lock statements don't scale</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/05/03/90944.aspx</link><pubDate>Mon, 03 May 2010 13:32:15 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:90944</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>1</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/90944.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=90944</wfw:commentRss><description>&lt;p&gt;We are going to have to stop using lock statements one day. Just like we had to stop using goto statements. The problem is similar, they're pretty easy to follow in small programs, but code with locks isn't composable. That means that small pieces of program that work in isolation can't necessarily be put together and work together.&lt;/p&gt;  &lt;p&gt;Of course &lt;a href="http://code.google.com/p/n-act/"&gt;actors&lt;/a&gt; scale fine :)&lt;/p&gt;  &lt;h5&gt;Why lock statements don't scale as software gets bigger&lt;/h5&gt;  &lt;p&gt;Deadlocks.&lt;/p&gt;  &lt;p&gt;You have a program with lots of threads picking up lots of locks. You already know that if two of your threads both try to pick up a lock that the other already has, they will deadlock. Your program will come to a grinding halt, and there will be fire and brimstone.&lt;/p&gt;  &lt;p&gt;"Easy!" you say, "Just make sure all the threads pick up the locks in the same order." Yes, that works. But you've broken composability. Now, to add a new lock to your code, you have to consider all the other locks already in your code and check that they are taken in the right order. Algorithm buffs will have noticed this approach means it takes &lt;em&gt;quadratic time&lt;/em&gt; to write a program. That's bad.&lt;/p&gt;  &lt;h5&gt;Why lock statements don't scale as hardware gets bigger&lt;/h5&gt;  &lt;p&gt;Memory bus contention&lt;/p&gt;  &lt;p&gt;There's another headache, one that most programmers don't usually need to think about, but is going to bite us in a big way in a few years. Locking needs exclusive use of the entire system's memory bus while taking out the lock. That's not too bad for a single or dual-core system, but already for quad-core systems it's a pretty large overhead. Have a look at &lt;a href="http://blogs.msdn.com/pfxteam/archive/2010/04/13/9995622.aspx"&gt;this blog about the .NET 4 ThreadPool&lt;/a&gt; for some numbers and a weird analogy (see the author's comment). Not too bad yet, but I'm scared my 1000 core machine of the future is going to go slower than my machine today!&lt;/p&gt;  &lt;p&gt;I don't know the answer to this problem yet. Maybe some kind of per-core work queue system with hierarchical work stealing. Definitely hardware support.&lt;/p&gt;  &lt;p&gt;But what I do know is that using locks specifically prevents any solution to this. We should be abstracting our code away from the details of locks as soon as possible, so we can swap in whatever solution arrives when it does.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.google.com/p/n-act/"&gt;NAct&lt;/a&gt; uses locks at the moment. But my advice is that you code using actors (which do scale well as software gets bigger). And when there's a better way of implementing actors that'll scale well as hardware gets bigger, only NAct needs to work out how to use it, and your program will go fast on it's own.&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=90944" width="1" height="1"&gt;</description></item><item><title>A better way to do concurrent programming</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/04/18/90685.aspx</link><pubDate>Sun, 18 Apr 2010 11:27:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:90685</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>3</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/90685.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=90685</wfw:commentRss><description>&lt;p&gt;Programming to take advantage of multicore processors is hard. If you let multiple threads access the same memory, bad things happen. To avoid this, you use the lock keyword, but if you use that in the wrong way, your code deadlocks. It's all a nightmare.&lt;/p&gt;

&lt;p&gt;Luckily, there's a better way - Actors. They're really easy to think about. They're really safe (if you follow a couple of simple rules).&lt;/p&gt;

&lt;p&gt;And high-performance, type-safe actors are now available for .NET by using this open-source library:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/n-act/"&gt;http://code.google.com/p/n-act/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have a look at the site for details. I'll blog with more reasons to use actors and tips and tricks to get the best parallelism from them soon.&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=90685" width="1" height="1"&gt;</description></item><item><title>What do you call an obfuscator that isn't an obfuscator?</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/04/15/90660.aspx</link><pubDate>Thu, 15 Apr 2010 11:22:04 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:90660</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>2</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/90660.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=90660</wfw:commentRss><description>&lt;p&gt;SmartAssembly, formerly {smartassembly}, version 5 is now available as an Early Access Build. You can get it here:    &lt;br /&gt;&lt;a href="http://www.red-gate.com/MessageBoard/viewforum.php?f=116"&gt;http://www.red-gate.com/MessageBoard/viewforum.php?f=116&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We're having second thoughts about the name change though. It isn't that we like the curly brackets, far from it. The trouble is that the first rule of product naming is to name a product by what it does. SmartAssembly may make an assembly smarter, but that's not something people really google for. &lt;/p&gt;  &lt;p&gt;The trouble is, I can't think of a better name for it. &lt;/p&gt;  &lt;p&gt;That's because SmartAssembly really does two completely separate things: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Obfuscates&lt;/li&gt;    &lt;li&gt;Sets up your assembly for the awesome exception reports which get sent to you whenever your application crashes. You may have been (un?)lucky enough to see one in reflector if you use it. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This is what those exception reports look like when they arrive back with the developer:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.simple-talk.com/blogbits/Alex_Davies/Whatdoyoucallanobfuscatorthatisntanobfus_A82F/Exreport.png"&gt;&lt;img title="Exreport" border="0" alt="Exreport" src="http://www.simple-talk.com/blogbits/Alex_Davies/Whatdoyoucallanobfuscatorthatisntanobfus_A82F/Exreport_thumb.png" width="554" height="665" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Look at all those local variables! If you ask me, this is &lt;em&gt;much&lt;/em&gt; cooler than the obfuscation.&lt;/p&gt;  &lt;p&gt;So obviously we don't want to call it just "Red Gate Obfuscator" or something, because it doesn't do justice to the exception reporting.&lt;/p&gt;  &lt;p&gt;What would you call it?&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=90660" width="1" height="1"&gt;</description></item><item><title>Why not to use StackTrace to find what method called you</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/02/18/89932.aspx</link><pubDate>Thu, 18 Feb 2010 12:52:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:89932</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>2</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/89932.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=89932</wfw:commentRss><description>&lt;p&gt;Our obfuscator, &lt;a href="http://www.smartassembly.com/" target="_blank"&gt;SmartAssembly&lt;/a&gt;, does some pretty crazy reflection. It's an obfuscator, it's sort of its job to do things in the most awkward way possible.&lt;/p&gt;  &lt;p&gt;But sometimes, you can go too far. One such time is this little gem from the strings encoding feature:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;StackTrace stackTrace = &lt;span class="kwrd"&gt;new&lt;/span&gt; StackTrace();
StackFrame frame = stackTrace.GetFrame(1);
Type ownerType = frame.GetMethod().DeclaringType;&lt;/pre&gt;

&lt;p&gt;It's designed to find the type where the calling method is defined.&lt;/p&gt;

&lt;p&gt;A user found that strings encoding occasionally broke on x64 systems. Very strange. After some debugging (thank god for &lt;a href="http://www.red-gate.com/products/reflector/" target="_blank"&gt;Reflector Pro&lt;/a&gt;, it would be impossible to debug processed assemblies without it) I found that the ownerType I got back was wrong.&lt;/p&gt;

&lt;p&gt;The reason is that the x64 JIT does tail call optimisation. This saves space on the stack, and speeds things up, by throwing away a method's stack frame if the last thing that it calls is the only thing returned. When this happens, the call to StackTrace faithfully tells you that the calling method is the one that called the one we really wanted.&lt;/p&gt;

&lt;p&gt;So using StackTrace isn't safe for anything other than debugging, and it will make your code fail in unpredictable ways. Don't use it!&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=89932" width="1" height="1"&gt;</description></item><item><title>Reflector Pro moves into beta!</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/01/20/87639.aspx</link><pubDate>Wed, 20 Jan 2010 11:30:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:87639</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>65</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/87639.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=87639</wfw:commentRss><description>&lt;p&gt;Reflector Pro's builds are getting pretty stable now. So we've decided to call this one a beta! Download it now from &lt;a href="http://www.red-gate.com/products/reflector/index.htm?utm_source=simpletalk&amp;utm_medium=blog&amp;utm_content=reflectorprobeta&amp;utm_campaign=reflector"&gt;http://www.red-gate.com/products/reflector/downloadbeta.htm&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;There are two components to this project really, and we're hoping you'll like both of them:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;.NET Reflector Visual Studio add-in &lt;/li&gt;    &lt;li&gt;.NET Reflector 6 &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;The new Visual Studio add-in&lt;/h4&gt;  &lt;p&gt;We've written a Visual Studio add-in that will install when you run Reflector. It has two main features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Letting you jump to Reflector from your code (this is free!) &lt;/li&gt;    &lt;li&gt;Debugging decompiled code using the visual studio debugger (this is Reflector Pro - so will cost money) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here's what it'll look like to jump to Reflector from VS:&lt;/p&gt;  &lt;p&gt;&lt;img title="Open in Reflector" border="0" alt="Open in Reflector" src="/blogbits/Alex_Davies/ThetimeisnearlyuponusReflectorPromovesin_9771/OpeninReflector.png" width="604" height="405" /&gt; &lt;/p&gt;  &lt;p&gt;Click it and Reflector fires up, showing you Math.Pow. Simple as that. Saves me a good amount of time opening Reflector and searching for things (not to mention forgetting why I wanted to see it on the way!)&lt;/p&gt;  &lt;p&gt;The debugging feature (Reflector Pro) is what we're most excited about (ok, so it's what we hope will pay for us to eat, but it is very cool too). It can decompile a whole assembly, and generate debug symbols for it. From there, you can see the decompiled code in Visual Studio, and all VS's normal debugging features spring to life. You can step in, set breakpoints, inspect and modify variables, and even use VS2010's new IntelliTrace feature to time-travel through your debugging session.&lt;/p&gt;  &lt;p&gt;&lt;img title="Debugging Decompiled" border="0" alt="Debugging Decompiled" src="/blogbits/Alex_Davies/ThetimeisnearlyuponusReflectorPromovesin_9771/DebuggingDecompiled.png" width="604" height="519" /&gt; &lt;/p&gt;  &lt;p&gt;Pretty cool, no? This is the kind of leap (like Reflector was) which I dread to think how much time I could have saved if I'd had it in previous projects. Nowadays, I never have to just stare at a bug and guess what's wrong anymore: I just decompile and jump in to take a look.&lt;/p&gt;  &lt;h4&gt;What's new in .NET Reflector 6&lt;/h4&gt;  &lt;p&gt;We've spent a lot of time tweaking and improving Reflector itself as well.&lt;/p&gt;  &lt;p&gt;&lt;img title="Reflector standalone" border="0" alt="Reflector standalone" src="/blogbits/Alex_Davies/ThetimeisnearlyuponusReflectorPromovesin_9771/Reflectorstandalone.png" width="468" height="625" /&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;There are lots of things that successfully decompile now that didn't before. &lt;/li&gt;    &lt;li&gt;.NET 4.0 is now supported (although that doesn't include decompiling to C# 4.0 language features, all the .NET 4 assemblies can be browsed). &lt;/li&gt;    &lt;li&gt;The Open Cache dialog now shows you all the assemblies in .NET's Global Assembly Cache (GAC). &lt;/li&gt;    &lt;li&gt;We've tidied up some graphics (including some really nice new icons). &lt;/li&gt;    &lt;li&gt;Lots of the little annoyances with the user interaction are solved too. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So grab &lt;a href="http://www.red-gate.com/products/reflector/index.htm?utm_source=simpletalk&amp;utm_medium=blog&amp;utm_content=reflectorprobeta&amp;utm_campaign=reflector" target="_blank"&gt;grab yourself a copy&lt;/a&gt;. This is our last chance to make any last minute changes, so please post on &lt;a href="http://www.red-gate.com/messageboard/viewforum.php?f=85" target="_blank"&gt;the forum&lt;/a&gt; with any suggestions or bugs you find.&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=87639" width="1" height="1"&gt;</description></item><item><title>Remote Debugging with Reflector Pro - It could have been so easy!</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2010/01/05/85477.aspx</link><pubDate>Tue, 05 Jan 2010 17:38:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:85477</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>3</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/85477.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=85477</wfw:commentRss><description>.. but it isn't :(&lt;br&gt;&lt;br&gt;Visual Studio's remote debugger is a really neat bit of kit that lets people with a lot of patience and no firewalls debug processes on a test machine using a visual studio instance on a completely separate development machine.&lt;br&gt;&lt;br&gt;Obviously it would be great if you could combine this ability with &lt;a href="http://www.red-gate.com/messageboard/viewforum.php?f=109"&gt;Reflector Pro&lt;/a&gt; to decompile and debug any .NET assembly running on any machine. It is possible, but it's not automatic, much to my annoyance.&lt;br&gt;&lt;br&gt;The problem is that the .NET remote debugging system loads its .pdb files from the test machine, rather than from the machine running VS. (I found this with the help of &lt;a href="http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/05/26/visual-studio-remote-debugging-and-pdb-files.aspx"&gt;John Robbins' blog post&lt;/a&gt;).&lt;br&gt;&lt;br&gt;Reflector Pro generates .pdb files on your development machine. VS knows where to find them, but it chooses to ignore them (in fact, worse, you can watch it looking on the test machine for them in paths that only exist on the dev machine).&lt;br&gt;&lt;br&gt;The workaround is to copy the .pdb files from Reflector Pro's debug store (which are located in your user's local application data in \Red Gate\.NET Reflector 6\Cache) and put them on the test machine, next to the running assemblies. The remote debugger will find them and everything will spring to life, showing you the decompiled code on the dev machine (which you don't have to copy anywhere).&lt;br&gt;&lt;br&gt;Hope that helps some people!&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=85477" width="1" height="1"&gt;</description></item><item><title>Debugging your interaction with other people's code - Reflector Pro is in EAP!</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2009/09/22/74919.aspx</link><pubDate>Tue, 22 Sep 2009 08:25:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:74919</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>23</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/74919.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=74919</wfw:commentRss><description>If you're read &lt;a href="/community/blogs/bart/archive/2009/03/23/72559.aspx"&gt;Bart&lt;/a&gt; or &lt;a href="/community/blogs/clivet/archive/2009/07/20/74071.aspx"&gt;Clive&lt;/a&gt;'s blog recently, you might be as excited as I am about the next version of Reflector that we're working on.&lt;br&gt;&lt;br&gt;.NET Reflector is great for working out what on earth is going on in the framework or third party code you work with every day. But when you're right in the middle of debugging and your method call does something you don't expect, you just want to step into the world below and work out why.&lt;br&gt;&lt;br&gt;Well now you can! An &lt;a href="http://www.red-gate.com/MessageBoard/viewtopic.php?t=9577"&gt;Early Access Program of Reflector Pro&lt;/a&gt; is available from our forums.&lt;br&gt;&lt;br&gt;It's a bit rough around the edges, but we like fast release iterations, so you can expect it to improve rapidly.&lt;br&gt;&lt;br&gt;Here is where you choose which assemblies to debug:&lt;br&gt;&lt;br&gt;&lt;img src="/community/blogs/alex/attachment/74919.ashx" alt="Assembly Chooser&amp;lt;/img&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Then you just need to "&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Once you've decompiled an assembly, you can press "Step into" (F11) on any line that calls into your decompiled assembly, and you'll be in the decompiled code, watching the variables change. Awesome!&lt;br&gt;&lt;br&gt;Are you interested in helping test the usability of the new feature? We are looking for people with issues which Reflector debugging could help with. Email usability at red-gate.com if you'd like to help, and please don't try out the tool beforehand, so we can see your first reactions.&lt;br&gt;&lt;br&gt;Just have to come clean that the debugging feature won't be available in the free edition of Reflector - but we will of course keep the free edition, and make improvements to it that we need for Reflector Pro (so everyone wins). We've been improving .NET 4 support, for example.&lt;br&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=74919" width="1" height="1"&gt;</description><enclosure url="http://www.simple-talk.com/community/blogs/alex/attachment/74919.ashx" length="105153" type="image/png" /></item><item><title>Decompile everywhere!</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2009/09/01/74615.aspx</link><pubDate>Tue, 01 Sep 2009 10:12:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:74615</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/74615.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=74615</wfw:commentRss><description>Everyone knows that &lt;a href="http://www.red-gate.com/products/reflector/index.htm?utm_source=simpletalk&amp;amp;utm_medium=blog&amp;amp;utm_content=alex-decompile&amp;amp;utm_campaign=reflector"&gt;.NET Reflector&lt;/a&gt; is magic. It makes C# or VB code where there was no code before. Quite cool, I'm sure you agree.&lt;br&gt;&lt;br&gt;But when you have the source code to .NET Reflector, and products that need new features, you can really have some fun!&lt;br&gt;&lt;br&gt;For &lt;a href="http://www.red-gate.com/products/Exception_Hunter/index.htm?utm_source=simpletalk&amp;amp;utm_medium=blog&amp;amp;utm_content=alex-decompile&amp;amp;utm_campaign=exceptionhunter"&gt;Exception Hunter&lt;/a&gt; 2 we were really focussing on helping users to interpret the situations where an exception might be thrown. So we put in a source code view to show you your source, and where it throws exceptions:&lt;br&gt;&lt;br&gt;
&lt;img src="http://www.red-gate.com/support/Exception_Hunter/help/2.0/shovellexceptions.gif" alt="Exception Hunter's source view"&gt;

&lt;br&gt;&lt;br&gt;But a lot of the time, the exceptions are thrown by library methods, and have no source code. That's where .NET Reflector comes in, of course. We've integrated Reflector's decompilation capability into Exception Hunter, so when you drill into a stack trace and arrive at a library method, you get decompiled code to help work out what's going on:&lt;br&gt;&lt;br&gt;
&lt;img src="/community/blogs/alex/attachment/74615.ashx" alt="Decompiled exceptions"&gt;&lt;br&gt;&lt;br&gt;Awesome!&lt;br&gt;&lt;br&gt;I can't promise anything, but at some point we might able to get some deep (line-level timing?) insight into how libraries perform as well!&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=74615" width="1" height="1"&gt;</description><enclosure url="http://www.simple-talk.com/community/blogs/alex/attachment/74615.ashx" length="169043" type="image/png" /></item><item><title>Learning by doing - an experimental memory profiling tutorial</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2009/06/25/73863.aspx</link><pubDate>Thu, 25 Jun 2009 09:22:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:73863</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/73863.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=73863</wfw:commentRss><description>Through the development of &lt;a href="http://www.red-gate.com/products/ants_memory_profiler/index.htm?utm_source=simpletalk&amp;amp;utm_medium=blog&amp;amp;utm_content=alexblog-learningbywritingblogposts&amp;amp;utm_campaign=antsmemoryprofiler"&gt;ANTS Memory Profiler&lt;/a&gt; 5, we realised that the
most serious barrier to customers wanting to buy memory profilers was
how complex and hard-to-understand memory profiling is.&lt;br&gt;&lt;br&gt;It
happened that, for other reasons, I'd architected the memory
profiler UI as a reusable component. Halfway though
the project, I had the idea to use it to throw together a game-style tutorial mode for the memory profiler, to lead people though some common workflows in a mocked-up memory profiler UI.&lt;br&gt;&lt;br&gt;Brian got wind of this, and showed me his &lt;a href="/dotnet/.net-tools/what-can-software-designers-learn-from-video-games-part-2/"&gt;article&lt;/a&gt; about how we should learn from video game designers, and lead people gradually though the new world of memory. Unfortuntately, I can't control the customer's own application to cause it to have simple kinds of memory leak to start with!&lt;br&gt;&lt;br&gt;Still, I believe the principle that you learn best by doing, and I want to test it. So now the project is over, I have enough time to manually engineer some of these tutorials, and see if anyone finds them useful.&lt;br&gt;&lt;br&gt;&lt;img src="/community/blogs/alex/attachment/73863.ashx" alt="Memory Profiler Tutorial screenshot"&gt;&lt;br&gt;&lt;br&gt;You can &lt;a href="http://labs.red-gate.com/index.php/ANTS_Memory_Profiling_Tutorials"&gt;find them at the labs wiki&lt;/a&gt;. Give them a go, let me know what you think of the idea.&lt;br&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=73863" width="1" height="1"&gt;</description><enclosure url="http://www.simple-talk.com/community/blogs/alex/attachment/73863.ashx" length="48221" type="image/png" /></item><item><title>Why I don't care where my objects are created</title><link>http://www.simple-talk.com/community/blogs/alex/archive/2009/05/07/73376.aspx</link><pubDate>Thu, 07 May 2009 09:25:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:73376</guid><dc:creator>Alex.Davies</dc:creator><slash:comments>1</slash:comments><comments>http://www.simple-talk.com/community/blogs/alex/comments/73376.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/alex/commentrss.aspx?PostID=73376</wfw:commentRss><description>Back when we were designing the &lt;a href="http://www.red-gate.com/MessageBoard/viewforum.php?f=92&amp;amp;utm_source=simpletalk&amp;amp;utm_medium=blog&amp;amp;utm_content=alexblog-allocationcallstack&amp;amp;utm_campaign=antsmemoryprofiler"&gt;new memory profiler&lt;/a&gt; last year, Andrew had realised that there was one thing that made all the exisiting memory profilers slow the profiled application to a crawl. That was remembering the place in the program (the call stack) that every object gets allocated. We've decided to take this feature out, not even including it as an option for v5.0, and here's why.&lt;br&gt;&lt;br&gt;Once upon a time, there were programming languages where you had to free all the memory that you allocated. If you didn't, the memory would be lost forever, the traditional unmanaged code memory leak. So people thought of clever ways to make their code less prone to memory leaks. One of these was a principle that whichever piece of code allocated memory was also responsible to making sure it is freed when you're finished with it.&lt;br&gt;&lt;br&gt;This wasn't a bad principle, and many good programs were written leak free because of it. Some programs got leaks though, so someone invented memory profilers. These were good because they would tell you where you had allocated the pieces of memory that weren't freed. You could then fix the problem because it was always the code that allocated the memory that was responsible for freeing it.&lt;br&gt;&lt;br&gt;Then one day (ok, so excuse my chronology, it's been around for ages) someone invented garbage collection. Joy! We no longer had to worry about freeing memory, it was freed on its own when not referenced anymore. The old technique of copying data that needed to be passed became obselete, we could send our memory off into the distance, not knowing what adventures might be waiting for it.&lt;br&gt;&lt;br&gt;But sometimes the data had misadventures. It might get referenced by something it shouldn't do, end up in the wrong cache, and the managed memory leak was born. So managed memory profilers appeared. They were good because they told you where your memory was allocated, because it's always the job of the code that allocates the memory to free... oh, wait, no it's not!&lt;br&gt;&lt;br&gt;The code that allocates memory has no responsibility over what happens to the memory, and usually has nothing to do with the code that leaks it.&lt;br&gt;&lt;br&gt;So I think we've made a brave step, removing this age-old feature. Because it's not actually useful.&lt;br&gt;&lt;br&gt;Instead, what's useful is knowing why your object is in memory still, and that's all about what's referencing it. In particular how it's connected to GC roots. So that's what we've tried to make the memory profiler v5 good for investigating (and I think if you try it you'll agree, we succeeded). Also, it's a gazillion times faster because it doesn't have to hook into every object allocation.&lt;br&gt;&lt;br&gt;The only trouble is, on rare occasions, allocation call stacks are useful. There is a (frankly horrible) system in .NET called the IDisposable pattern. It asks you to free (call Dispose() on) objects you've allocated. It's necessary because .NET is built on top of the unmanaged world, where it's important not to wait for the garbage collector before a resource is freed. I hate it, because it chains us back up to the technique of the piece of code that allocates an object having to dispose it. Maybe here allocation call stacks might be useful again. But because of finalizers, people are very rarely actually bitten when they forget to dispose things. Hopefully one day, everything will be designed so it can wait for the garbage collector before it gets freed, and the world will be a happier place.&lt;br&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=73376" width="1" height="1"&gt;</description></item></channel></rss>
