Author Topic: Reverse Engineering NET 2.0  (Read 6680 times)

Oliver Michalski

  • EA User
  • **
  • Posts: 116
  • Karma: +0/-0
    • View Profile
Reverse Engineering NET 2.0
« on: July 11, 2005, 09:14:23 am »
I have begun to work with Net FX 2.0 beta 2 At the attempt to document existing assemblies by reverse engineering I only keep the error message "Not a valid Net- Assembly"  :'(

My Question:

Is there  a time framework , when EA can co-operate with Net FX 2.0 ?

Thanks
Oliver Michalski

AshK

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #1 on: July 11, 2005, 09:19:44 pm »
Hi Oliver,

Thanks for reporting this problem.  

My initial expectations are: this is likely work if you use the reflection based importer, and are using the FX 2.0 runtime.

I'd be happy to update you once I've investigated this issue, however I'll need some time.

Thanks again,

Ash
The Sparx Team
[email protected]

Oliver Michalski

  • EA User
  • **
  • Posts: 116
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #2 on: July 11, 2005, 11:21:03 pm »
Hi Ash,

thank you for your quick answer. I will wait for your update.

Yours sincerely

Oliver   :D

thomaskilian

  • Guest

Oliver Michalski

  • EA User
  • **
  • Posts: 116
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #4 on: July 12, 2005, 04:09:02 am »
Hi Thomas,

AssemblyMetadata2XMI.exe only works with Net Fx 1.1 (same Problem with System.Reflection).

Thanks
Oliver

DamonCarr

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #5 on: July 12, 2005, 09:59:21 am »
Oliver,

Hi! Damon Carr, CEO of agilefactor. We are working on the new Metadata format for XMI creation via DotNet2UML.

We have a dot release coming our that fixes some 1.1 bugs and then we are doing a 2.0 release. We are looking at other techniques of reflectin such as FxCop and direct binay IL reading tathern then reflection as it doesn''t have all the data we need  to catch every dependency (typicaly). Like whem a class is created in a method and GCed (eventualy) with no method argument for that class. We need to actually read the code to know that there is a dependency as that class create the other.

ONe solution is we were going to use custom attributtes but that buts the burden on the programmer to remember. In this case is tould say:

[ClassDependency("Classa", "1..1")]

I might be able to use the attributes inside the IDE to do some interesting this as well.... As I said we are still deciding (grin).

I would expect a release in the next six weeks. In the mean time, did you try the new 'Code Engineering' --> 'Import Binary Model'? That works with 1.1 and I've never tried it with 2.0. It is an actual replacement for DotNet2UML for 1.1 (I think it even works better). Geoffrey ans his team actually do read the IL if they need to. It's quite a powerful new feature.

Kind regards,
Damon carr
Thanks,

Damon Carr, Chief Technologist
agilefactor
http://damon.agilefactor.com

Oliver Michalski

  • EA User
  • **
  • Posts: 116
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #6 on: July 13, 2005, 12:28:50 am »
Hi Damon,

thank you for your Answer. I have read about the new Version of DotNet2UML in your Yahoo Group and I can hardly expect it,to try the new version.

I tried the "Import Binary feature". I only keep the error message "Not a valid Net- Assembly".I think it give a problem with the System.Reflection namespace. In order to work with Net Fx 2.0 Assemblies, would have to be used System.Reflection in the version 2.0. To what extent Net Fx 1.1 Assemblies are then incorrectly analyzed, I don't know.I think the best way for the problem to be solved: Read the IL Code. One of the best Reflection Tools (Reflector of Lutz Roeder) use this technology.

Using from Custom Attributes (No comment  ;))


Kind regards from Germany
Oliver Michalski

DamonCarr

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #7 on: July 16, 2005, 12:46:02 pm »
Oliver,

Agreed... I don't like the custom attributes either. I failed to mention we are also looking at the Reflector API as a solution. One benefit of attributes however is we can use AOP to take action on those attributes in our system for validity checking. I have written an AOP framework that illustrates how this works and let me know if you would like a copy (it is free until I evolve it enough to be something people would considering paying for and if it can be sigbigifantly better then the other AOP frameworks.. It will probably always be free).

Relationships in UML are easy (at least 1 to 1 or 0 to 1) as well as cases of aggregation and composition (simply stronger semantic versions of the relationship that people always seem to mix up - including me (girn))  that are not one to many. As you have an instance (private hopefully as public is a violation of good OO principles - You are exposing internal data of a class to the outside workd - If you need to do this add Property Accessors for your private containted instance) but one to many are vert hard as most in 1.1 use non-strongly typed collections so we have NO IDEA what is being stored in that collection. It could be an Invoice object and the private collection may store InvoiceDetail instances. We need to find a way to infer that from the code and attibutes are the only way for now to solve that.

In 2.0 of course we have Generics and Strongly Typed Collections (which I am not sure how will be exposed through reflection as I have simply not checked). That would solve that problem.

The ONLY WAY to know if a DEPENDENCY exists is often to read the code. As in my example when a method instantiates an instance of 'InvoiceDetail' but it is not a parameter to any method. The method then uses that object and perhaps stores it in that weakly types Hashtable. We would have no idea to draw that Dependency line (as by the use of the class that other class now has a dependency on InvoiceDetail) is to :

1) Read all the IL
2) See if this information is provided in either the FxCOP or the Reflector APIs

Even then it is impossible in many cases as we use metadata and reflection.

So the code might :

1) Read an item from some metadata table to get the Type that is going to be created
2) A Type is created based on the String and the Activaor is used to spin up the instrance
3) Work is done on the instance.

We are usually saved however as eventually that instance (usually through a safe-case (as)) will be cast into it's proper type from object (what an Activator usually returns). So we can use that to know even with one of our most common design patterns (and one you should all be using in the Java and .NET world) metadata driven, reflection based instantiation. Of course there is a performance overhead but this is usually so minute compared to the overhead of out of process calls (like to Oracle for example).

Anyway, we are on this... Geoffrey is also with his ability to read binary files. Our tool still has value for other UML tools that do not support this feature or where we can add value to what he has added to Sparx.

On comment to Sparx Engineering: It would be nice to specify the scope of the items we want imported. I often don't want all the private stuff imported but there is no way I am aware to avoid that now.

Kind Regards,
Damon Carr
« Last Edit: July 16, 2005, 12:53:20 pm by DamonCarr »
Thanks,

Damon Carr, Chief Technologist
agilefactor
http://damon.agilefactor.com

Jeff Odell

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #8 on: July 18, 2005, 06:46:07 am »
From DamonCarr:

On comment to Sparx Engineering: It would be nice to specify the scope of the items we want imported. I often don't want all the private stuff imported but there is no way I am aware to avoid that now.

Agreed.  I made a specific support request to Sparx for this feature.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #9 on: July 18, 2005, 03:47:18 pm »
Quote
On comment to Sparx Engineering: It would be nice to specify the scope of the items we want imported. I often don't want all the private stuff imported but there is no way I am aware to avoid that now.

Fair enough.  You do realise that you can stop a class from displaying private attributes and operations.  (Element | Set Feature Visibility) It doesn't solve the problem, the attributes still exist in the model, but it can hide them on diagrams.

Simon

Oliver Michalski

  • EA User
  • **
  • Posts: 116
  • Karma: +0/-0
    • View Profile
Re: Reverse Engineering NET 2.0
« Reply #10 on: August 31, 2005, 04:45:08 am »
Hi Ash,

any updated information available ?

Thanks
Oliver  ;)