<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>.NET on Andrew Walsh</title><link>http://awalsh128.com/tags/.net/</link><description>Recent content in .NET on Andrew Walsh</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><copyright>© 2026 Andrew Walsh</copyright><lastBuildDate>Wed, 30 Mar 2016 23:52:15 -0700</lastBuildDate><atom:link href="http://awalsh128.com/tags/.net/feed.xml" rel="self" type="application/rss+xml"/><item><title>State behavioral pattern to the rescue.</title><link>http://awalsh128.com/state-behavioral-pattern-to-rescue/</link><pubDate>Mon, 17 Mar 2014 00:00:00 -0700</pubDate><guid>http://awalsh128.com/state-behavioral-pattern-to-rescue/</guid><description>&lt;h3 class="relative group"&gt;The Creeping Problem&#10; &lt;div id="the-creeping-problem" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-creeping-problem" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;I recently found myself developing a request-response style system,&#10;where the lifetime of a request could be interrupted at any moment. For&#10;most same process execution, like your average desktop application, this&#10;is a concern, but arises more often when dealing with multiple&#10;coordinated processes. My case ended up being the latter.&lt;/p&gt;</description></item><item><title>PCAP-NG reader for .NET.</title><link>http://awalsh128.com/pcap-ng-reader-for-net/</link><pubDate>Wed, 10 Apr 2013 00:00:00 -0700</pubDate><guid>http://awalsh128.com/pcap-ng-reader-for-net/</guid><description>&lt;h3 class="relative group"&gt;Introduction &amp;amp; Scope&#10; &lt;div id="introduction--scope" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#introduction--scope" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;The PCAP-NG file format is used to store network captured data used by&#10;great programs like &lt;a href="http://www.wireshark.org/download.html" target="_blank" rel="noreferrer"&gt;Wireshark&lt;/a&gt;.&#10;There are several API's available for both&#10;&lt;a href="http://www.tcpdump.org/" target="_blank" rel="noreferrer"&gt;Linux&lt;/a&gt; and &lt;a href="http://www.winpcap.org/" target="_blank" rel="noreferrer"&gt;Windows&lt;/a&gt;&#10;but none that are ported to .NET. I decided to &lt;a href="https://github.com/awalsh128/PcapngFile/" target="_blank" rel="noreferrer"&gt;make&#10;one&lt;/a&gt; for my own use in&#10;building a network traffic replay agent.&lt;/p&gt;</description></item><item><title>Reading and writing large binary data in T-SQL and ADO.NET.</title><link>http://awalsh128.com/reading-and-writing-large-binary-data/</link><pubDate>Wed, 03 Oct 2012 00:00:00 -0700</pubDate><guid>http://awalsh128.com/reading-and-writing-large-binary-data/</guid><description>&lt;h3 class="relative group"&gt;Introduction&#10; &lt;div id="introduction" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#introduction" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;In some cases, you may want to read/write binary data from/to your&#10;relational database. This can be a problem when the data set size&#10;exceeds the memory address size (eg. 32-bit processes) or the &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc534993.aspx" target="_blank" rel="noreferrer"&gt;managed&#10;large object&#10;heap&lt;/a&gt; cannot&#10;load it all without throwing an&#10;&lt;a href="http://msdn.microsoft.com/en-us/library/system.outofmemoryexception.aspx" target="_blank" rel="noreferrer"&gt;OutOfMemoryException&lt;/a&gt;.&#10;In those cases, you will need to load the data into memory in chunks.&#10;Fortunately, the &lt;a href="http://en.wikipedia.org/wiki/Transact-SQL" target="_blank" rel="noreferrer"&gt;T-SQL&lt;/a&gt;&#10;syntax supports this operation.&lt;/p&gt;</description></item><item><title>IMAPI version 2 managed wrapper.</title><link>http://awalsh128.com/imapi-version-2-managed-wrapper/</link><pubDate>Tue, 18 Sep 2012 00:00:00 -0700</pubDate><guid>http://awalsh128.com/imapi-version-2-managed-wrapper/</guid><description>&lt;h3 class="relative group"&gt;Introduction&#10; &lt;div id="introduction" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#introduction" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;Microsoft &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366450%28v=vs.85%29.aspx" target="_blank" rel="noreferrer"&gt;introduced native image&#10;mastering&lt;/a&gt;&#10;support in Vista, going forward. The library itself is not too complex&#10;but the latest version of the &lt;a href="http://en.wikipedia.org/wiki/Image_Mastering_API" target="_blank" rel="noreferrer"&gt;image mastering API&#10;(IMAPI)&lt;/a&gt; has some&#10;quirks. This is well documented by &lt;a href="http://www.codeproject.com/script/Membership/View.aspx?mid=208197" target="_blank" rel="noreferrer"&gt;Eric&#10;Haddan&lt;/a&gt;&#10;in his&#10;&lt;a href="http://www.codeproject.com/Articles/24544/Burning-and-Erasing-CD-DVD-Blu-ray-Media-with-C-an" target="_blank" rel="noreferrer"&gt;article&lt;/a&gt;&#10;describing how to build an interop file and use it from .NET.&lt;/p&gt;</description></item><item><title>Licensing using XML digital signing.</title><link>http://awalsh128.com/licensing-using-xml-digital-signing/</link><pubDate>Tue, 14 Aug 2012 00:00:00 -0700</pubDate><guid>http://awalsh128.com/licensing-using-xml-digital-signing/</guid><description>&lt;h3 class="relative group"&gt;Motivation&#10; &lt;div id="motivation" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#motivation" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;One of the main concerns in any licensing implementation is that&#10;authored license files are coming from the trusted authority (ie. your&#10;company) and not some third party. This can be accomplished in software&#10;by encrypting and decrypting the license with a &lt;a href="http://en.wikipedia.org/wiki/Symmetric-key_algorithm" target="_blank" rel="noreferrer"&gt;single&#10;key&lt;/a&gt;, but&#10;symmetric &lt;a href="http://en.wikipedia.org/wiki/Key_management" target="_blank" rel="noreferrer"&gt;key storage&lt;/a&gt; can&#10;be cumbersome and have added complexity.&lt;/p&gt;</description></item><item><title>POCO not transforming into a POCO proxy.</title><link>http://awalsh128.com/poco-not-transforming-into-poco-proxy/</link><pubDate>Mon, 07 Nov 2011 00:00:00 -0800</pubDate><guid>http://awalsh128.com/poco-not-transforming-into-poco-proxy/</guid><description>&lt;p&gt;A POCO (Plain Old CLR Object) must be transformed into a POCO proxy&lt;br&gt;&#10;[MyNamespace.MyClass&#10;-&amp;gt;{System.Data.Entity.DynamicProxies.MyClass_0A943C2FC37D33304CEB497A9210C754E3F553B50315F8E6F0F7A6FAF43777F2}]{.Apple-style-span&#10;style=&amp;ldquo;font-size: x-small;&amp;rdquo;})&lt;br&gt;&#10;in order for features like lazy loading and change tracking to work.&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;a href="http://msdn.microsoft.com/en-us/library/dd468057.aspx" target="_blank" rel="noreferrer"&gt;MSDN has a great&#10;article&lt;/a&gt; that&#10;explains how to prepare a POCO to be transformed into a proxy. If you&#10;find that an object retrieved or attached to the context does not show&#10;itself in the DynamicProxies namespace (eg. MyNamespace.MyClass instead&#10;of ...DynamicProxies.MyClass), then you probably don't have a&#10;compliant class. You may have noticed this already when hovering your&#10;mouse cursor over an instance and seeing the runtime information on it.&lt;br&gt;&#10;&lt;br&gt;&#10;The distilled points are that your POCO must:&lt;/p&gt;</description></item><item><title>Writing a TEDS (IEEE 1451.4) parser.</title><link>http://awalsh128.com/writing-teds-ieee-14514-parser/</link><pubDate>Wed, 17 Aug 2011 00:00:00 -0700</pubDate><guid>http://awalsh128.com/writing-teds-ieee-14514-parser/</guid><description>&lt;p&gt;I was tasked recently with writing a parser for TEDS bit stream data.&#10;There is an &lt;a href="http://standards.ieee.org/develop/regauth/tut/teds.pdf" target="_blank" rel="noreferrer"&gt;IEEE published&#10;paper&lt;/a&gt; with an&#10;overview of the standard but it doesn't give any examples for&#10;implementation. I was finally able to find a&#10;&lt;a href="http://standards.ieee.org/develop/regauth/tut/tdl.pdf" target="_blank" rel="noreferrer"&gt;paper&lt;/a&gt; that gave&#10;examples but still had trouble parsing the data. I finally realized&#10;there is not only 2 selector bits after the basic TEDS block but&#10;selector bits inside the standard template (2 in the case of template&#10;25). Here are my main findings:&lt;br&gt;&#10;\&lt;/p&gt;</description></item><item><title>Reentrant lock acquires in CLR.</title><link>http://awalsh128.com/reentrant-lock-acquires-in-clr/</link><pubDate>Fri, 29 Jul 2011 00:00:00 -0700</pubDate><guid>http://awalsh128.com/reentrant-lock-acquires-in-clr/</guid><description>&lt;p&gt;I always like when a post gets to the point (especially after searching&#10;in Google). In short, &lt;em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms741870.aspx" target="_blank" rel="noreferrer"&gt;if you perform an operation that waits to&#10;acquire a lock, the thread doesn't actually&#10;stop&lt;/a&gt;&lt;/em&gt;.&lt;br&gt;&#10;&lt;br&gt;&#10;In concrete terms of .NET coding, if you call the&#10;&lt;a href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.waitone.aspx" target="_blank" rel="noreferrer"&gt;WaitOne&lt;/a&gt; method&#10;on a thread, it may still process events that the CLR deems &amp;quot;high&#10;priority&amp;quot;. This can be a big problem if the event handlers go into the&#10;critical region you are trying to protect.&lt;br&gt;&#10;\&lt;/p&gt;</description></item></channel></rss>