Author Topic: Compatability of .NET dlls and AutoCAD versions  (Read 12894 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #15 on: March 27, 2008, 09:18:32 AM »
Ok, we are going round and round and evidently I am not capable of making myself clear.

This application is not written as a .NET assembly, it is written in a combination of VB and C++.
I could rewite the tens of thousands of lines of code in .NET, but considering the unsecure nature of .NET dlls and the relative cost of the software, I fear end users would decompile it and years of work would be lost, not to mention the issue of having to upgrade the software at the whim of Autodesk.

Now, since this is a self contained program that runs entirely on its own, it runs in its own memory space. This creates an issue with marshalling. If you understand what marshalling is, then you understand the severity of the problem, particularly considering the fact that the program grows every year to include more functionality.

Users have expressed an intrest in getting the interface to look more like their other windows. This would mean that I need to include a manifest for the program, however, given the nature of the program, the close ties it has to AutoCAD and the amount of interaction required between the two, its style should look similar to AutoCAD's. The most efficient method would be to use the AutoCAD manifest to set the style of our software. The problem is that Autodesk does not expose the manifest, however, I can still use the AutoCAD manifest by loading this software in the AutoCAD memory space. So, in the end I resolve 2 problems.

1) marshalling is eliminated
2) manifest is applied

The question is really simple, at least I think it is simple. You don't need to think about the what, where or why, only can.

That being said, can a .NET assembly written for R2004 work in all versions of R2004 - R2009 provided that the .NET assembly does not use any AutoCAD interop libraries.

This .NET assembly would merely load my software, which can be ran as a stand alone program, into the AutoCAD process. Really I don't know how much simpler I can say it, or what else I can say to make it more clear.


Now to answer a few of the questions raised
I think you started out asking about porting C++ and VB6 code to .NET...? 
No I didn't, it has always been about using .NET to load another program into AutoCAD memory space


But you are also saying something about a ".NET loader" that, um... loads something into memory?  ...maybe the C++/VB6 stuff?

Exactly, but the .NET assembly must be able to run on ANY version of AutoCAD from R2004 - R2009 (current versions)


I'm not really sure what you're asking, or what you are trying to accomplish.  If you are simply trying to load existing C++ and VB6 stuff into memory, I'm not sure why or how you're trying to use .NET.
Why: Marshalling elimination and manifest inclusion.
How: Reference my DLL in the .NET assembly and call it from there.


  If you need to provide .NET programmatic access to C++ stuff, then that would be done by creating a managed DLL for your stuff. 
I don't need .NET except to load my software into AutoCAD memory space.

If you are merely trying to convert existing working code to .NET, then why are you doing that, since it sounds like you really don't want to?
No, I do not want to, .NET is notoriously insecure. It can be decompiled in merely seconds or can be edited in place without ever decompiling.

so he uses it twice and it pays for itself ?
.. thats a pretty reasonable ROI. Seems to me the client could afford to update AutoCAD by the third usage.
Without spending lots of time explaining the workflow process of the users, it would be hard to imagine. Consider this as a comparison to calculating the trajectory of a spaceship to Pluto using an abacus. Regardless, some clients have a complete ROI after 1 use, with some users it takes as many as 10 uses.

With the new release, due in the next month or so, the pricing is also increasing by about 20%-25%.

But then you can't really put a price tag on the savings you would realize if the program prevented you from making a serious mistake in your data processing. Imagine if you had a single misplaced decimal on your structural calculations for a bridge, and that bridge ultimately failed because of it ... unfathomable ... of course these things would be checked over and over again, but what if ...

Keith, Do you beta test your mission critical applications on new releases of AutoCAD before shipping? Just to make sure something is not broken?
We go through months of in house testing, trying to imagine all the ways a user would abuse the software. After we do that, we put it in a real world environment for a month or so, just to let the guys who will use it see if they can break it. Only then does it get released for general usage ... and when something is found to be broken and it is brought to our attention, we try to issue an update within 24 hours, although it has taken as long as 72 hours.

Of course we can't test for potential issues with AutoCAD 2010 ... or any other future release not yet conceived, so as such, when a company chooses to not upgrade, we want the user to be able to continue to use our software even when they do upgrade AutoCAD, without forcing an upgrade to our software. It sounds counter productive, but we have users still on the second release and we are already working on the 6th release.

To date we have had only 1 serious bug and it was resolved within hours and all users were patched. Even then, this did not affect 75% of the users. There have been maybe 4 or 5 incidental bugs since that didn't affect the end product. Not that there are not any, we just havn't found a way to break it ... yet ... but we are wtill trying.

Really , I am not trying to be difficult, I am merely wanting to speed things up for the users, and do so without burdoning the already tight production schedule.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Draftek

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #16 on: March 27, 2008, 09:45:04 AM »
Quote
The question is really simple, at least I think it is simple. You don't need to think about the what, where or why, only can.

That being said, can a .NET assembly written for R2004 work in all versions of R2004 - R2009 provided that the .NET assembly does not use any AutoCAD interop libraries.

Nope!

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #17 on: March 27, 2008, 09:49:16 AM »
Then the choice is made ... doing a .NET assembly is not an option.

I suppose I'll have to feed my software to AutoCAD using brute force.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8698
  • AKA Daniel
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #18 on: March 27, 2008, 10:04:45 AM »
2004 doesn’t have .NET, But I bet you can use one DLL for 2005-2009 if you don’t reference the managed extensions and strictly use p/invoke

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #19 on: March 27, 2008, 10:16:24 AM »
2004 doesn’t have .NET, But I bet you can use one DLL for 2005-2009 if you don’t reference the managed extensions and strictly use p/invoke

That is pretty much what I was looking for
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

sinc

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #20 on: March 27, 2008, 10:41:04 AM »
Yeah, I'm not sure why you couldn't get a DLL to work in versions 2005+.  You may need to target the .NET 1.1 Framework.  Or maybe not - I haven't tried doing anything with pre-2007 .NET in Autocad.

But it sounds strange.  I had gotten the impression that all the manifest did was tell your legacy app to use the V6 controls if they are available, which enables your legacy app to use the current visual style set in XP or Vista.  The style itself is in the OS - all you need to do is specify that your app should use the version 6 controls.  As such, I wouldn't expect you to need to get a manifest from Autocad.  At least, that was my understanding, which may be completely wrong.

And I don't really understand what marshalling issue you are trying to solve.  Is the problem that you are instantiating one instance of your custom app for every drawing your users open, and you are trying to get it to instantiate only a single instance of your app?  Or is it something else?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #21 on: March 27, 2008, 11:24:26 AM »
Yeah, I'm not sure why you couldn't get a DLL to work in versions 2005+.  You may need to target the .NET 1.1 Framework.  Or maybe not - I haven't tried doing anything with pre-2007 .NET in Autocad.

Ok .. I can reference the .NET 1.1 framework if needed, that isn't an issue ...

But it sounds strange.  I had gotten the impression that all the manifest did was tell your legacy app to use the V6 controls if they are available, which enables your legacy app to use the current visual style set in XP or Vista.  The style itself is in the OS - all you need to do is specify that your app should use the version 6 controls.  As such, I wouldn't expect you to need to get a manifest from Autocad.  At least, that was my understanding, which may be completely wrong.

All the manifest does is cause your application to use the visual styles set in XP or Vista, however, each application has its own manifest implementation. The manifest can be modified as well to enhance the visual style. So far as the manifest is concerned, I am looking to force this application to look like it is a native AutoCAD command, a first step is to utilize the AutoCAD manifest tucked nicely away in one of the AutoCAD DLLs. It is irrelevant if the program is written in VB, C++, or a .NET language.

And I don't really understand what marshalling issue you are trying to solve.  Is the problem that you are instantiating one instance of your custom app for every drawing your users open, and you are trying to get it to instantiate only a single instance of your app?  Or is it something else?

Marshalling happens whenever any application interacts with another application while they are running in seperate processes. Thus, if I run my application as an executable, it by the sheer nature of computing, must marshall data between the processes. If that data segment is large, performance takes a considerable hit.

I don't have to worry about instantiating multiple applications, If the user attempts to open the program twice, the second instance fails and merely brings the first instance into focus.

In VB the call would be something along the lines of

Code: [Select]
If App.PrevInstance Then
     ActivatePrevInstance 'defined elsewhere
   Else
     ThisApplicationWindow.Show
  End If
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8698
  • AKA Daniel
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #22 on: March 27, 2008, 11:40:31 AM »
Yeah, I'm not sure why you couldn't get a DLL to work in versions 2005+.  You may need to target the .NET 1.1 Framework.  Or maybe not - I haven't tried doing anything with pre-2007 .NET in Autocad.

Ok .. I can reference the .NET 1.1 framework if needed, that isn't an issue ...

You can use .NET 2.0 on 05, 06, works just fine  :-)

Nathan Taylor

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #23 on: March 27, 2008, 05:51:14 PM »
Yeah, I'm not sure why you couldn't get a DLL to work in versions 2005+.  You may need to target the .NET 1.1 Framework.  Or maybe not - I haven't tried doing anything with pre-2007 .NET in Autocad.

Ok .. I can reference the .NET 1.1 framework if needed, that isn't an issue ...

You can use .NET 2.0 on 05, 06, works just fine  :-)

I had issues using .NET 1.1 with later versions of AutoCAD Map.

sinc

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #24 on: March 27, 2008, 06:00:29 PM »
Hmmm...  and when I converted my .NET stuff to 2009, it also complained because it was in 2.0...  I upped the target framework to 3.5, and it was happy.  I didn't try to force the issue, though - I just switched to the 3.5 and didn't think about it anymore.  If I tried to stay with 2.0, I don't know if I would have serious problems or not in 2009.  I wouldn't expect to, but the compiler was complaining...

Nathan Taylor

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #25 on: March 27, 2008, 06:04:57 PM »
Hmmm...  and when I converted my .NET stuff to 2009, it also complained because it was in 2.0...  I upped the target framework to 3.5, and it was happy.  I didn't try to force the issue, though - I just switched to the 3.5 and didn't think about it anymore.  If I tried to stay with 2.0, I don't know if I would have serious problems or not in 2009.  I wouldn't expect to, but the compiler was complaining...

Do you know if 3.5 can be used with VS2005 or is VS2008 necessary.

Glenn R

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #26 on: March 27, 2008, 06:46:41 PM »
Do you know if 3.5 can be used with VS2005 or is VS2008 necessary.

Visual Studio 2005 knows nothing about the .NET 3.0 and 3.5 frameworks. It knows *some* of the .NET 3.0 WPF, WCF, WF stuff it you install the correct addons, but essentially, WRT 3.5, VS2008 is da stuff.

Keith,

Acad 2005 was the first .NET "aware" acad (and even this was a first implementation, which they significantly changed in 2006), therefor, 2006 - 2009 should load your stuff ok, depending on my previous post. As far as I'm aware (and Dan already alluded to), any version prior to 2005 wouldn't even know what a .NET .dll is, let alone know what to do with it.

Hope this helps some.

Cheers,

StefanDidak

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #27 on: April 05, 2008, 08:39:41 AM »
Hmmm...  and when I converted my .NET stuff to 2009, it also complained because it was in 2.0...  I upped the target framework to 3.5, and it was happy.  I didn't try to force the issue, though - I just switched to the 3.5 and didn't think about it anymore.  If I tried to stay with 2.0, I don't know if I would have serious problems or not in 2009.  I wouldn't expect to, but the compiler was complaining...

There would not have been any problems. That error (the warning from one of the *mgd.dll's right?) doesn't seem to have any relevance. I'm currently maintaining 4 (VS2008) versions of the same C3D project which are done in NET 2.0 and NET 3.5 for both C3D 2008 and 2009. So far extensive testing has not shown any problems with any of the combinations. You can check out the VS2008/NET20/C3D2008 result by downloading the C3D GENIO Importer from the Autodesk site. :-)



sinc

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #28 on: April 05, 2008, 10:33:59 AM »
OK, that's what I would've guessed, I just haven't had a chance to explore it yet.

Stefan, do you also get a lot of warnings whenever you compile something for C3D?  If I include a reference to any of the C3D interops, I get a lot of warnings about types that claim they are defined in Autodesk.AutoCAD.Interop.dll, but could not be found.  The messages seem to be innocuous, but they are annoying, and they make it difficult to see the REAL warnings.  A successful compile of one of my projects (with two subprojects) results in 228 of these things.

Is there some way to get rid of those warnings?  Or is it in something Autodesk did, and it's just something we have to live with?

StefanDidak

  • Guest
Re: Compatability of .NET dlls and AutoCAD versions
« Reply #29 on: April 05, 2008, 10:42:01 AM »
Is there some way to get rid of those warnings?  Or is it in something Autodesk did, and it's just something we have to live with?

I assume you're talking about a whole bunch of warnings of the type 1684? Those warnings are a (nasty) side effect of the way the whole API has been constructed and there's no way to get rid of them other than to suppress the warning in the *.csproj file(s) and stick with warning level 4. They'll still be there but at least they won't clutter up the output. I noticed that one of the minimalistic C3D managed code samples also had the warning suppressed so it just seems the way "things are".