<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Transaction.Dispose() always throws exception in AutoCAD 2016 in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604267#M40337</link>
    <description>&lt;P&gt;What happens if you go the Using (...) route?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Apr 2015 23:08:38 GMT</pubDate>
    <dc:creator>dgorsman</dc:creator>
    <dc:date>2015-04-22T23:08:38Z</dc:date>
    <item>
      <title>Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604163#M40336</link>
      <description>&lt;P&gt;I have some code that works well in AutoCAD versions 2012-2015 which opens a transactions, looks up some object info, then disposes the transaction.&amp;nbsp; In 2016 this code thows an&amp;nbsp;AccessViolationException ("Attempted to read or write protected memory. This is often an indication that other memory is corrupt.") as soon as Dispose() is called.&amp;nbsp; I have removed transactions in a few spots in code, using direct reads through the ObjectId, which works just fine.&amp;nbsp; Everytime I replace a chunk of code with this method the next chunk that uses a Transaction starts puking.&amp;nbsp; Obviously something is very wrong or very different in AutoCAD 2016 if I cannot even use a transaction.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 22:37:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604163#M40336</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-22T22:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604267#M40337</link>
      <description>&lt;P&gt;What happens if you go the Using (...) route?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 23:08:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604267#M40337</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2015-04-22T23:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604338#M40338</link>
      <description>&lt;P&gt;The code is actually in a using pattern.&amp;nbsp; I confirmed that it is the Dispose() call causing the grief by refactoring the code chunk to call it explicitly.&amp;nbsp; So the using blocks are failing because they are calling Dispose().&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2015 01:17:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604338#M40338</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-23T01:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604365#M40339</link>
      <description>Can you post some sample code that exhibits this? I have not yet run into this issue.</description>
      <pubDate>Thu, 23 Apr 2015 02:07:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604365#M40339</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2015-04-23T02:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604419#M40340</link>
      <description>&lt;P&gt;I have a variety of code running into this which is all proprietary, but here is one example of what is typically being done:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using (var transaction = someDbObject.Database.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; //do some work&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is as simple as it is to throw the exception.&amp;nbsp; It also throw in these cases if I do no work at all, but just manually start the transaction and then manually dispose of it.&amp;nbsp; Please note that this is code that has been working for a couple of years starting with Acad 2012 on through 2015, and now is throwing up all over 2016.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2015 03:58:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5604419#M40340</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-23T03:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5605949#M40341</link>
      <description>&lt;P&gt;It would appear that AutoCAD 2016 now requires that some activities be conducted in the appropriate threading context.&amp;nbsp; As soon as I started doing my work inside a call to Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.ExecuteInCommandContextAsync(...) stuff started working.&amp;nbsp; I saw this same thing happen in Revit last year.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2015 21:14:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5605949#M40341</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-23T21:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5692399#M40342</link>
      <description>&lt;P&gt;Perhaps i'm missing something, but isn't the point of "using" so you don't need to call dispose?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2015 22:25:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5692399#M40342</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-24T22:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction.Dispose() always throws exception in AutoCAD 2016</title>
      <link>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5693210#M40343</link>
      <description>In C#, using is just syntactic sugar. It really creates the equivalent of&lt;BR /&gt;a try/finally, and calls .Dispose() for you. The problem here isn't with&lt;BR /&gt;how .Dispose() gets called, it is that it wasn't working right. I ended&lt;BR /&gt;up rewriting to get around this.</description>
      <pubDate>Thu, 25 Jun 2015 13:40:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/transaction-dispose-always-throws-exception-in-autocad-2016/m-p/5693210#M40343</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-25T13:40:34Z</dc:date>
    </item>
  </channel>
</rss>

