<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Rhonda Tipton&#039;s Blog &#187; Debugging</title>
	<atom:link href="http://rhondatipton.net/category/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>http://rhondatipton.net</link>
	<description>Stuff I Learn, Stuff I Like</description>
	<lastBuildDate>Mon, 26 Mar 2012 03:33:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rhondatipton.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rhonda Tipton&#039;s Blog &#187; Debugging</title>
		<link>http://rhondatipton.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rhondatipton.net/osd.xml" title="Rhonda Tipton&#039;s Blog" />
	<atom:link rel='hub' href='http://rhondatipton.net/?pushpress=hub'/>
		<item>
		<title>Reading The Windows Event Log</title>
		<link>http://rhondatipton.net/2010/12/19/reading-the-windows-event-log/</link>
		<comments>http://rhondatipton.net/2010/12/19/reading-the-windows-event-log/#comments</comments>
		<pubDate>Sun, 19 Dec 2010 14:06:03 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">https://rtipton.wordpress.com/2010/12/19/reading-the-windows-event-log/</guid>
		<description><![CDATA[I had a need recently to access the Windows event logs. Reading the Event Log is useful when you want to be notified when a program fails. You read the Events and if there is a fatal error, do something like send an email the owner of the process. This is helpful if you have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&#038;blog=148560&#038;post=1868&#038;subd=rtipton&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img style="display:inline;border-width:0;" title="IMG_3365" src="http://rtipton.files.wordpress.com/2010/12/img_3365.jpg?w=400&h=170" border="0" alt="IMG_3365" width="400" height="170" /></p>
<p>I had a need recently to access the Windows event logs. Reading the Event Log is useful when you want to be notified when a program fails. You read the Events and if there is a fatal error, do something like send an email the owner of the process. This is helpful if you have a console application that runs all the time unattended.</p>
<p>The .Net Framework offers the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx" target="_blank">System.Diagnostics.EventLog</a> class. This class gives you the power to interact with the Windows event logs.</p>
<p>&nbsp;</p>
<p>Below is a C# program that accesses the Windows event logs.</p>
<pre class="code"><span style="color:blue;">using </span>System;
<span style="color:blue;">using </span>System.Text;
<span style="color:blue;">using </span>System.Diagnostics;

<span style="color:blue;">class </span><span style="color:#2b91af;">Program
</span>{
    <span style="color:blue;">static void </span>Main(<span style="color:blue;">string</span>[] args)
    {
        <span style="color:#2b91af;">StringBuilder </span>sb = <span style="color:blue;">new </span><span style="color:#2b91af;">StringBuilder</span>();
        <span style="color:#2b91af;">EventLog </span>log = <span style="color:blue;">new
        </span><span style="color:#2b91af;">EventLog</span>(<span style="color:#a31515;">"Application"</span>);

        <span style="color:#2b91af;">DateTime </span>dt = <span style="color:#2b91af;">DateTime</span>.Now.AddHours(-1.00);
        <span style="color:#2b91af;">Console</span>.WriteLine(dt.ToString());

        <span style="color:blue;">foreach </span>(<span style="color:#2b91af;">EventLogEntry </span>entry <span style="color:blue;">in </span>log.Entries)
        {
            <span style="color:blue;">if </span>(entry.TimeGenerated &gt; dt)
            {
                <span style="color:#2b91af;">Console</span>.WriteLine(entry.Source);
                <span style="color:#2b91af;">Console</span>.WriteLine(entry.EntryType);
                <span style="color:#2b91af;">Console</span>.WriteLine(entry.Message);
                <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"--------"</span>);
            }
        }

        <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">"Done"</span>);
        <span style="color:#2b91af;">Console</span>.ReadLine();
    }
}</pre>
<div><span style="font-size:xx-small;"><a href="https://gist.github.com/341885" target="_blank">C# Listing on GitHub</a></span></div>
<p>&nbsp;</p>
<p>Below is the result of executing the code above. As you can see I had a crash in my Windows Live Writer Application.</p>
<p><a href="http://rtipton.files.wordpress.com/2010/12/20101219_073757.jpg" target="_blank"><img style="display:inline;border-width:0;" title="2010-12-19_073757" src="http://rtipton.files.wordpress.com/2010/12/20101219_073757_thumb.jpg?w=499&h=252" border="0" alt="2010-12-19_073757" width="499" height="252" /></a></p>
<p>&nbsp;</p>
<p>Below is the Event Viewer and you can see there as well where there was an issue with the WLW application.</p>
<p><a href="http://rtipton.files.wordpress.com/2010/12/20101219_074318.jpg" target="_blank"><img style="display:inline;border-width:0;" title="2010-12-19_074318" src="http://rtipton.files.wordpress.com/2010/12/20101219_074318_thumb.jpg?w=503&h=378" border="0" alt="2010-12-19_074318" width="503" height="378" /></a></p>
<p>&nbsp;</p>
<p>I can see where this class can be very helpful and plan on doing more research into what it can do as far as reading as well as writing operations.</p>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;">Related Information</span></p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx" target="_blank">EventLog Class Definition and Specifications on MSDN</a></li>
<li><a href="http://www.codeproject.com/KB/dotnet/SystemDiagnostics_basics.aspx" target="_blank">Beginning System.Diagnostics on CodeProject</a></li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1868/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1868/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1868/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&#038;blog=148560&#038;post=1868&#038;subd=rtipton&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/12/19/reading-the-windows-event-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">RTipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/12/img_3365.jpg" medium="image">
			<media:title type="html">IMG_3365</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/12/20101219_073757_thumb.jpg" medium="image">
			<media:title type="html">2010-12-19_073757</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/12/20101219_074318_thumb.jpg" medium="image">
			<media:title type="html">2010-12-19_074318</media:title>
		</media:content>
	</item>
		<item>
		<title>Debugging: Failed to Enable Constraints</title>
		<link>http://rhondatipton.net/2010/11/23/debugging-failed-to-enable-constraints/</link>
		<comments>http://rhondatipton.net/2010/11/23/debugging-failed-to-enable-constraints/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 02:38:34 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">https://rtipton.wordpress.com/2010/11/23/debugging-failed-to-enable-constraints/</guid>
		<description><![CDATA[I have a DataSet that has had a new field added to it recently. When my console application runs, it was throwing a &#8220;Failed to enable constraints&#8221; exception. I needed to find out which column in the DataSet was causing the error, so a co-worker suggested I create a temporary data adapter/set, so I can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&#038;blog=148560&#038;post=1849&#038;subd=rtipton&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have a DataSet that has had a new field added to it recently. When my console application runs, it was throwing a &#8220;Failed to enable constraints&#8221; exception.</p>
<p><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2010/11/image.png?w=500&h=59" width="500" height="59"> </p>
<p>I needed to find out which column in the DataSet was causing the error, so a co-worker suggested I create a temporary data adapter/set, so I can examine the <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.geterrors.aspx">GetErrors()</a> method.
<div>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#008000;">/*</span>
<span style="color:#008000;">*/</span>
<span style="color:#008000;">//-- Table Adaptor and DataSet with issue</span>

spRoxStaffImportTableAdapter roxStaffImportTA = 
    <span style="color:#0000ff;">new</span> spRoxStaffImportTableAdapter();

RoxStaffImport.Data.StaffImport.spRoxStaffImportDataTable importdt = 
    roxStaffImportTA.spRoxStaffImport();
            
            
<span style="color:#008000;">//-- Table Adaptor and DataSet with my temporary TA and DS</span>

spRoxStaffImportTableAdapter roxStaffImportTA = 
    <span style="color:#0000ff;">new</span> spRoxStaffImportTableAdapter();

<span style="color:#008000;">//added for debugging</span>
RoxStaffImport.Data.StaffImport myDS = 
    <span style="color:#0000ff;">new</span> RoxStaffImport.Data.StaffImport(); 

<span style="color:#008000;">//added for debugging</span>
roxStaffImportTA.spRoxStaffImportfl(myDS.spRoxStaffImport);

<span style="color:#008000;">//changed for debugging</span>
RoxStaffImport.Data.StaffImport.spRoxStaffImportDataTable importdt = 
    myDS.spRoxStaffImport; //roxStaffImportTA.spRoxStaffImport();</pre>
</div>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><font size="1"><a href="https://gist.github.com/711051">C# Listing on GitHub</a></font> </p>
<p>Once the exception occurs, access the <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.geterrors.aspx">GetErrors()</a> property using the Watch window. This will tell you exactly what your issue is.</p>
<p><a href="http://rtipton.files.wordpress.com/2010/11/image1.png" target="_blank"><img style="border-width:0;" border="0" alt="image" src="http://rtipton.files.wordpress.com/2010/11/image_thumb.png?w=554&h=181" width="554" height="181"></a> </p>
<p>Once the issue is fixed, you can remove the temporary data adapter/set.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/1849/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/1849/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/1849/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&#038;blog=148560&#038;post=1849&#038;subd=rtipton&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2010/11/23/debugging-failed-to-enable-constraints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">RTipton</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/11/image.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://rtipton.files.wordpress.com/2010/11/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Debugging in .NET &#8211; Resources</title>
		<link>http://rhondatipton.net/2008/08/14/debugging-in-net-resources/</link>
		<comments>http://rhondatipton.net/2008/08/14/debugging-in-net-resources/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 01:07:48 +0000</pubDate>
		<dc:creator>Rhonda</dc:creator>
				<category><![CDATA[.NET General]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://rtipton.wordpress.com/2008/08/14/debugging-in-net-resources/</guid>
		<description><![CDATA[The main topic of our “brown bag” this week was Debugging in .NET.&#160; There is always a need for pointers on good debugging techniques, so I thought I would post some debugging resources here. Information Resources Sara Ford’s Blog – this blog is famous for the VS Tip of the Day Visual Studio .NET Debugging [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&#038;blog=148560&#038;post=715&#038;subd=rtipton&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[</p>
<p>The main topic of our “brown bag” this week was <a href="http://en.wikipedia.org/wiki/Debugging" target="_blank">Debugging</a> in .NET.&#160; There is always a need for pointers on good <a href="http://en.wikipedia.org/wiki/Debugging" target="_blank">debugging</a> techniques, so I thought I would post some <a href="http://en.wikipedia.org/wiki/Debugging" target="_blank">debugging</a> resources here.</p>
<p><strong>Information Resources</strong></p>
<ul>
<li><a href="http://blogs.msdn.com/saraford/" target="_blank">Sara Ford’s Blog</a> – this blog is famous for the <a href="http://blogs.msdn.com/saraford/archive/tags/Visual+Studio+2008+Tip+of+the+Day/default.aspx" target="_blank">VS Tip of the Day</a></li>
<li><a href="http://www.4guysfromrolla.com/webtech/chapters/VSNETDEBUG/" target="_blank">Visual Studio .NET Debugging Environment</a> – <em>4 Guys from Rolla</em></li>
<li><a href="http://www.eggheadcafe.com/articles/20050511.asp" target="_blank">Visual Studio.NET: Cool Debugging Tricks</a> &#8211; <em>Peter A. Bromberg</em></li>
</ul>
<p><strong>Video Tutorials</strong></p>
<ul>
<li><a href="http://www.dnrtv.com/default.aspx?showNum=66" target="_blank">Scott Hanselman on Debugging in .NET 2005</a></li>
<li><a href="http://www.dnrtv.com/default.aspx?showNum=78" target="_blank">Scott Hanselman on Debugging Part 2</a></li>
</ul>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
</p>
<p>&#8211;</p>
<p>Happy Learning !!!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/rtipton.wordpress.com/715/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/rtipton.wordpress.com/715/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rtipton.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/rtipton.wordpress.com/715/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/rtipton.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/rtipton.wordpress.com/715/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/rtipton.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/rtipton.wordpress.com/715/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/rtipton.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/rtipton.wordpress.com/715/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/rtipton.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/rtipton.wordpress.com/715/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/rtipton.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/rtipton.wordpress.com/715/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/rtipton.wordpress.com/715/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/rtipton.wordpress.com/715/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rhondatipton.net&#038;blog=148560&#038;post=715&#038;subd=rtipton&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rhondatipton.net/2008/08/14/debugging-in-net-resources/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/522aa96ec9478f99474af8ecab1c6247?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">RTipton</media:title>
		</media:content>
	</item>
	</channel>
</rss>
