Author Topic: MYNETLOAD - Extension Loader Diagnostic Tool  (Read 14002 times)

0 Members and 1 Guest are viewing this topic.

TheMaster

  • Guest
MYNETLOAD - Extension Loader Diagnostic Tool
« on: December 29, 2012, 09:23:38 PM »
For AutoCAD 2012:

If commands defined in your extension/plug-in assembly are not being recognized, this tool will attempt to identify the cause(s) of the problem.  The readme is in Class1.cs

If you try this tool and it does not detect the cause of unrecognized commands defined by your plug-in, please let me know about it.

[Edit: 12-31-12]:  Uploaded a revised version with a bug removed (the code was originally run from a menu item in my 'Managed Object Explorer' diagnostic tool, and had to be ripped out of that and have dependencies on other parts eliminated, which usually introduces a few bugs. :roll: ).
« Last Edit: December 31, 2012, 06:33:57 AM by TT »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #1 on: December 30, 2012, 02:37:20 AM »
Haven't tried it Tony, just looked through your comments.
This looks like it could make life easier for a lot of people.

Thanks for your continuing contribution to this expanding group of customisers and developers.
Best wishes for a healthy, safe and prosperous new year.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

TheMaster

  • Guest
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #2 on: December 30, 2012, 02:56:36 AM »
Haven't tried it Tony, just looked through your comments.
This looks like it could make life easier for a lot of people.

Thanks for your continuing contribution to this expanding group of customisers and developers.
Best wishes for a healthy, safe and prosperous new year.

Kerry, thanks.

I've only used it a few times to troubleshoot deployed software where the problem couldn't be repro'd on my systems here, and it saved my tail every time.

I usually run it myself on the remote system where the problem is, using TeamViewer, so the user doesn't need to do anything except watch.


gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #3 on: December 30, 2012, 05:28:48 AM »
Hi Tony,

Seems to be very interesting, thanks for sharing.
Happy new year to you and all swampers.
Speaking English as a French Frog

TheMaster

  • Guest
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #4 on: December 30, 2012, 02:14:55 PM »
Thanks Gile.

Happy New Year All

fixo

  • Guest
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #5 on: December 31, 2012, 08:09:25 AM »

Happy New Year All
Happy New Year Tony!
Thanks for your continuous help to all
Kind regards,
Oleg

zoltan

  • Guest
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #6 on: December 31, 2012, 04:31:59 PM »
Thanks Tony, this is very cool and will be of great help.

I did notice that you are collecting all of the command methods using reflection on this line..
Code - C#: [Select]
  1. var methods = type.GetMethods( BindingFlags.Public | BindingFlags.Instance )
  2.         .Where( m => m.IsDefined( typeof( ICommandLineCallable ), true ) );
  3.  
...which collects all of public, instance methods which are marked with the CommandMethodAttribute.

Is it not also true that command methods could be static if they are defined in a static class?



Jeff H

  • Needs a day job
  • Posts: 6144
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #7 on: December 31, 2012, 09:57:45 PM »
Thanks again boss!!

TheMaster

  • Guest
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #8 on: January 01, 2013, 11:05:32 AM »
Thanks Tony, this is very cool and will be of great help.

I did notice that you are collecting all of the command methods using reflection on this line..
Code - C#: [Select]
  1. var methods = type.GetMethods( BindingFlags.Public | BindingFlags.Instance )
  2.         .Where( m => m.IsDefined( typeof( ICommandLineCallable ), true ) );
  3.  
...which collects all of public, instance methods which are marked with the CommandMethodAttribute.

Is it not also true that command methods could be static if they are defined in a static class?

Yes, command methods can be static (in a static class or not), but the code is only looking for classes that have instance methods with CommandMethod attributes applied, because it is testing creation of an instance of each of those types.

VVeli

  • Newt
  • Posts: 27
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #9 on: January 03, 2013, 03:30:28 AM »
Thanks a lot Tony that you share information with us.
This is our problem too when we deliver products to customers.
Your code show us why native NETLOAD command works like a ****.

Most common problems usually are that .NET application is compiled
to different framework than AutoCAD. I think that AutoCAD 2013 is
purely compiled to framework 4.0 and below that are to framework 2.0.

Second problem is that if multiple classes uses commandclass attribute
then usually commands are missing.

Ok, thats all right now and good new year to all! :-D

Cheers
Veli V.

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #10 on: March 21, 2013, 07:52:00 PM »
Have you tested this on 2013 Tony?
I just did a sample deployment of my palette and tools and discovered it fails to load on about 1/3 of the target machines. Will definitely be using this tool to investigate.
Many thanks for this contribution!

TheMaster

  • Guest
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #11 on: March 21, 2013, 11:06:13 PM »
Have you tested this on 2013 Tony?
I just did a sample deployment of my palette and tools and discovered it fails to load on about 1/3 of the target machines. Will definitely be using this tool to investigate.
Many thanks for this contribution!

You may have to build it for 2013, but be advised that MYNETLOAD actually exposes a security flaw in AutoCAD's managed runtime that if exploited, may allow loading of 'unapproved' assemblies.


WILL HATCH

  • Bull Frog
  • Posts: 450
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #12 on: March 26, 2013, 01:28:51 PM »
Tony,

When running this program I get the following error:
Stacktrace: System.InvalidOperationException: ExtensionLoader not found
   at ExtensionLoaderTest.MyExtensionLoader.GetAssemblyLoadHandler()
   at ExtensionLoaderTest.MyExtensionLoader.EnableExtensionLoader(Boolean enable)
   at ExtensionLoaderTest.MyExtensionLoader.MyNetLoadCommand()

From analyzing your methods I can see you're trying to get the Application's ExtensionLoader object to extract the OnAssemblyLoad handler to stop it from being called while your tool is active.  I'll look into the issue to try and see what Autodesk has changed in the 'Big Split' that is causing the issue.

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #13 on: March 26, 2013, 11:56:37 PM »
Aww snap
found it here....

They found the security flaw you mentioned and fixed it.

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: MYNETLOAD - Extension Loader Diagnostic Tool
« Reply #14 on: March 27, 2013, 09:22:06 PM »
Hmmmm... Still no success.  It appears the security features are not what's limiting me though