<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[James's Programming Page — HidSharp - Catch error when device is unplugged]]></title>
		<link>https://swforum.seekye.com/topic/10083/</link>
		<atom:link href="https://swforum.seekye.com/feed/rss/topic/10083/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in HidSharp - Catch error when device is unplugged.]]></description>
		<lastBuildDate>Fri, 13 Nov 2015 20:10:27 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[HidSharp - Catch error when device is unplugged]]></title>
			<link>https://swforum.seekye.com/post/12944/#p12944</link>
			<description><![CDATA[<p>I&#039;m using the lib in windows.</p><p>I&#039;m continuously watching the HidStream for data which means that at each callback from BeginRead() I start a new BeginRead().</p><p>That is the way that I found to continuously watch for new inputs.</p><p>The only problem is that when the device is disconnected from the USB port, there is an error that I can&#039;t handle.<br />This error is saved in Exception field of AsyncResult&lt;T&gt; but there are 2 problems there:</p><p>1. - The callback parameter is IAsyncResult, which doesn&#039;t have Exception field.<br />2. - The Exception field in AsyncResult&lt;T&gt; is not public, so I cannot access it anyway.</p><p>I managed to solve by making the field Exception Public and inside the callback handler I do a cast to AsyncResult&lt;T&gt; which I also made public.</p><p>Is that right? Is there any better way to do that? </p><p>Thanks in advance.</p>]]></description>
			<author><![CDATA[null@example.com (giovaniluigi)]]></author>
			<pubDate>Fri, 13 Nov 2015 20:10:27 +0000</pubDate>
			<guid>https://swforum.seekye.com/post/12944/#p12944</guid>
		</item>
	</channel>
</rss>
