TheSwamp

Code Red => .NET => Topic started by: huiz on June 30, 2010, 02:31:09 PM

Title: No more debug in VB 2010 Express and AutoCAD
Post by: huiz on June 30, 2010, 02:31:09 PM
With VB 2008 Express I was able to debug my tools in AutoCAD, create breakpoints, check values, etc. In VB 2010 Express it seems not possible anymore.

Even if I have exactly the same configuration, the same framework, the same references, I always get the error when I try to break during a debug. See image below.

Do I overlook something?
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: Kerry on July 01, 2010, 01:41:23 AM

Is there a chance you are forcing 32 bit compile for a 64 bit system, or vice versa ??
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: huiz on July 01, 2010, 02:04:03 AM
No, it's just 32 bit.

The code does run, AutoCAD does start up, but breakpoints are ignored and I can't break. If I try to break I get that error message.

If there is an error in the code, the IDE pops up and it shows the error, at the line that caused the error, but I can't edit. Also I can't examin the values of objects.

Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: Kerry on July 01, 2010, 02:09:03 AM

Are you targeting the .NET 3.5 or .NET 4.0 explicitly ??

Do you have a file named Acad.exe.config in the same folder as acad.exe ??

What's in it ??

I don't use VB and I don't have express installed, so I'm guessing here :)
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: Kerry on July 01, 2010, 02:19:00 AM

Have a look at this for some ideas ;
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/22d4c3d3-bf77-40ed-8b1b-64223019f3f1
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: Kerry on July 01, 2010, 02:25:16 AM

This was the one I was thinking of ..
http://through-the-interface.typepad.com/through_the_interface/2010/04/hitting-breakpoints-in-net-class-libraries-while-debugging-with-visual-studio-2010.html
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: huiz on July 01, 2010, 03:12:07 AM
I use framework 3.5 because 4.0 is not compatible with AutoCAD. But reading your links it looks like the compiler still uses 4.0 internally while the program uses 3.5.

Thank you very much for the links, when I'm home I will try some solutions! Hope it will help :-)

Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: Kerry on July 01, 2010, 04:02:05 AM
You can target a version to compile.

How to: Target a Specific .NET Framework Version or Profile
http://msdn.microsoft.com/en-us/library/bb398202.aspx
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: huiz on July 01, 2010, 04:14:56 AM
Yes indeed. I already did because if I target 4.0 I get a lot of errors in AutoCAD. So I use 3.5.
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: huiz on July 01, 2010, 06:20:50 AM
Ah! Problem solved :-)

The file acad.exe.config contains:

Code: [Select]
<configuration>
<!--
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
-->

<!--All assemblies in AutoCAD are fully trusted so there's no point generating publisher evidence-->
   <runtime>       
<generatePublisherEvidence enabled="false"/>   
   </runtime>
</configuration>

If you change this to:
Code: [Select]
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

<!--All assemblies in AutoCAD are fully trusted so there's no point generating publisher evidence-->
   <runtime>       
<generatePublisherEvidence enabled="false"/>   
   </runtime>
</configuration>

then AutoCAD will run with framework v4.0, also with 3.5 etc.

Thanks Kerry for pointing me in the right direction  :-)
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: huiz on July 01, 2010, 06:29:20 AM
I just wonder, if there is no explicit configuration to v4.0, I still can't create tools using v4.0 on computers where that configuration is not edited. Or does it only affect the debug process?

In the case where I supply tools to my colleagues and they don't have write access to the config file...
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: It's Alive! on July 01, 2010, 06:32:20 AM
Why did you need to change from VS2008 to VS2010?
Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: huiz on July 01, 2010, 06:48:12 AM
Why did you need to change from VS2008 to VS2010?

There was no need but I changed from AutoCAD 2010 to 2011 and at the same time VB 2010 Express came out. So I thought, fresh start, fresh meat, all new :-)

Title: Re: No more debug in VB 2010 Express and AutoCAD
Post by: vegbruiser on July 05, 2010, 06:29:47 AM
For anyone that is interested, I too was having issues debugging in VB.NET 2010 Express using Inventor 2011.

There is an Inventor.exe.config file in the "C:\Program Files\Autodesk\Inventor 2011\Bin" directory whose contents should be amended thus:

BEFORE
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!-- $Header:$ -->
<!-- This config file is copied to the Inventor bin\ folder by //inventor/Main/sources/AddInApps/CCClient/AddIn/CCV2/PostBuild.bat -->
<configuration>
  <configSections>
    <sectionGroup name="autodesk.inventor.content">
      <section name="logging" type="System.Configuration.DictionarySectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
    </sectionGroup>
   
    <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
 
 
  <appSettings>
    <!-- Controls client cache allocation limit. MaxCachedObjects controls the maximum number
     of cached objects before a purge is done. CachePurgeInterval controls how many objects
     are removed when a purge is done -->
    <add key="Connectivity.Content.MaxCachedObjects" value="500"/>
    <add key="Connectivity.Content.CachePurgeInterval" value="100"/>
    <add key="Connectivity.Content.MaxSearchResults" value="2500"/>
    <!-- WebService timeout (in milliseconds)-->
    <add key="WebServiceTimeout" value="1000000"/>
  </appSettings>
  <microsoft.web.services3>
    <messaging>
      <maxMessageLength value="51200"/>
      <mtom clientMode="On" maxMimeParts="1024"/>
    </messaging>
    <security>
      <!-- Specifies the time buffer used by WSE to determine when a SOAP message is valid.
           set to the max of 24hr in seconds -->
      <timeToleranceInSeconds value="86400" />
    </security>
  </microsoft.web.services3>
  <!-- Since Inventor is an unmanaged application, we need to explicitly identify
     the framework version it's to use. Otherwise, it will pick up the latest
     version that's been installed -->
  <startup>
    <!-- The following specification works for both .NET 2.0 and .NET 3.0, since they share the same CLR.
         .NET 3.0 installs both
             C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 (the CLR) and
             C:\WINDOWS\Microsoft.NET\Framework\v3.0
         The 'v3.0' folder contains WPF and some other components built on top of .NET 2.0.
         Inventor won't start up if the following in changed to "V3.0" -->
        <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>
AFTER
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!-- $Header:$ -->
<!-- This config file is copied to the Inventor bin\ folder by //inventor/Main/sources/AddInApps/CCClient/AddIn/CCV2/PostBuild.bat -->
<configuration>
  <configSections>
    <sectionGroup name="autodesk.inventor.content">
      <section name="logging" type="System.Configuration.DictionarySectionHandler,system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
    </sectionGroup>
   
    <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
 
 
  <appSettings>
    <!-- Controls client cache allocation limit. MaxCachedObjects controls the maximum number
     of cached objects before a purge is done. CachePurgeInterval controls how many objects
     are removed when a purge is done -->
    <add key="Connectivity.Content.MaxCachedObjects" value="500"/>
    <add key="Connectivity.Content.CachePurgeInterval" value="100"/>
    <add key="Connectivity.Content.MaxSearchResults" value="2500"/>
    <!-- WebService timeout (in milliseconds)-->
    <add key="WebServiceTimeout" value="1000000"/>
  </appSettings>
  <microsoft.web.services3>
    <messaging>
      <maxMessageLength value="51200"/>
      <mtom clientMode="On" maxMimeParts="1024"/>
    </messaging>
    <security>
      <!-- Specifies the time buffer used by WSE to determine when a SOAP message is valid.
           set to the max of 24hr in seconds -->
      <timeToleranceInSeconds value="86400" />
    </security>
  </microsoft.web.services3>
  <!-- Since Inventor is an unmanaged application, we need to explicitly identify
     the framework version it's to use. Otherwise, it will pick up the latest
     version that's been installed -->
  <startup>
    <!-- The following specification works for both .NET 2.0 and .NET 3.0, since they share the same CLR.
         .NET 3.0 installs both
             C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 (the CLR) and
             C:\WINDOWS\Microsoft.NET\Framework\v3.0
         The 'v3.0' folder contains WPF and some other components built on top of .NET 2.0.
         Inventor won't start up if the following in changed to "V3.0" -->
[color=red]        <!-- <supportedRuntime version="v2.0.50727"/> -->
<supportedRuntime version="v4.0"/>[/color]
  </startup>
</configuration>

The changes I made are in RED.