473,651 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tool to find un-used methods from assemblies

Hi,

My application is splitted into more than one assembly. And I
want to clean up the methods which are not called or not used among any of
the assemblies. And also I want to remove the code for those methods which
are not called in any of my assemblies.

1) I want to remove all methods (either private,
protected, internal or public) methods which are not called (invoked) among
any of my assemblies.

2) If public access modifier is not required for that
method then I want to make it either internal of protected which ever is
applicable.

3) If no method is overridden in the derived classes
which are marked as virtual in base classes then I want to remove the
virtual keyword from the method signature in the base class.

It will be great if any one suggests me the tool which does all of tasks and
it will be great if that tool can remove the code from my source code as
well. Otherwise it will be great if any of the tools generates a report
based on my conditions.

Can any one suggest me the tools available to find and remove the un-used
methods or members?

Thanks in advance,

venkat
Jun 5 '06 #1
5 2089
Venkat,

I have to ask, for what reason do you want to do this? It's almost
impossible to do. It would mean that you have to explore every single code
branch, for every possible type of input from the main executable, to see
how your code is traversed through.

On top of that, if you add a new reference to your assembly, you have to
do the analysis all over again.

Finally, you will pollute your design by doing such things. Just
because methods aren't used doesn't mean that they aren't important, or
shouldn't be there.

For example, if you had a Dog object, and you didn't call it's Bark
method (but accessed it's NumberOfLegs property), it doesn't make sense to
remove the Bark method. All dogs bark, after all.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Venkat" <st******@palan tirsolutions.co m> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi,

My application is splitted into more than one assembly. And I
want to clean up the methods which are not called or not used among any of
the assemblies. And also I want to remove the code for those methods which
are not called in any of my assemblies.

1) I want to remove all methods (either private,
protected, internal or public) methods which are not called (invoked)
among any of my assemblies.

2) If public access modifier is not required for that
method then I want to make it either internal of protected which ever is
applicable.

3) If no method is overridden in the derived classes
which are marked as virtual in base classes then I want to remove the
virtual keyword from the method signature in the base class.

It will be great if any one suggests me the tool which does all of tasks
and it will be great if that tool can remove the code from my source code
as well. Otherwise it will be great if any of the tools generates a report
based on my conditions.

Can any one suggest me the tools available to find and remove the un-used
methods or members?

Thanks in advance,

venkat

Jun 5 '06 #2
See this tool:
http://msdn.microsoft.com/msdnmag/is...n/default.aspx

BTW you can use some IDE tools, like ReSharper 2.0 - it has feature to show
you unused fields/methods and allows to clean it up

My application is splitted into more than one assembly. And I
want to clean up the methods which are not called or not used among any of
the assemblies. And also I want to remove the code for those methods which
are not called in any of my assemblies.

1) I want to remove all methods (either private,
protected, internal or public) methods which are not called (invoked) among
any of my assemblies.

2) If public access modifier is not required for that
method then I want to make it either internal of protected which ever is
applicable.

3) If no method is overridden in the derived classes
which are marked as virtual in base classes then I want to remove the
virtual keyword from the method signature in the base class.

It will be great if any one suggests me the tool which does all of tasks and
it will be great if that tool can remove the code from my source code as
well. Otherwise it will be great if any of the tools generates a report
based on my conditions.

Can any one suggest me the tools available to find and remove the un-used
methods or members?


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 5 '06 #3
"Michael Nemtsev" <ne*****@msn.co m> wrote in message
news:67******** *************** ***********@mic rosoft.com...
See this tool:
http://msdn.microsoft.com/msdnmag/is...n/default.aspx

BTW you can use some IDE tools, like ReSharper 2.0 - it has feature to
show
you unused fields/methods and allows to clean it up


Not public or protected members, though.
Jun 5 '06 #4
The new Phoenix framework will do this sort of thing and much more. Not out
yet, but hope is on the way.

--
William Stacey [MVP]

"Venkat" <st******@palan tirsolutions.co m> wrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
| Hi,
|
| My application is splitted into more than one assembly. And I
| want to clean up the methods which are not called or not used among any of
| the assemblies. And also I want to remove the code for those methods which
| are not called in any of my assemblies.
|
|
|
| 1) I want to remove all methods (either private,
| protected, internal or public) methods which are not called (invoked)
among
| any of my assemblies.
|
| 2) If public access modifier is not required for that
| method then I want to make it either internal of protected which ever is
| applicable.
|
| 3) If no method is overridden in the derived classes
| which are marked as virtual in base classes then I want to remove the
| virtual keyword from the method signature in the base class.
|
|
|
|
|
| It will be great if any one suggests me the tool which does all of tasks
and
| it will be great if that tool can remove the code from my source code as
| well. Otherwise it will be great if any of the tools generates a report
| based on my conditions.
|
|
|
| Can any one suggest me the tools available to find and remove the un-used
| methods or members?
|
|
|
| Thanks in advance,
|
| venkat
|
|
Jun 5 '06 #5
The best tool I know of to analyze code this way is NCover
(http://ncover.org). Resharper (http://www.jetbrains.com/resharper/)
may be able to accomplish what you need too, but I've never used it.

Hope this helps.

Dan Manges
Jun 5 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6279
by: Agathe | last post by:
Bonjour, Je souhaite insérer dans une table MySQL des données provenant d'un fichier texte grâce à un script PHP. Mon fichier porte l'extension "txt" et les données sont séparées par des ";'. J'ai créé un script qui upload le fichier texte sur le serveur et qui lit le contenu de chaque ligne, sépare chaque champ, puis stocke les données dans un tableau indicé pour ensuite insérer ces données dans une table MySQL. Mon script fonctionne...
10
4358
by: pmdanger | last post by:
Hi, I'm new in java and my customer want an application which works under LINUX and WINDOWS plat forms. So, i though logically in JAVA. As i need to select my development tool, i would like to choose the right one and not to throw money by windows...
3
3888
by: pascal Joseph | last post by:
J'ai un formulaire avec un seul champ text appelé "unite" et un bouton. En javascript j'aimerai utiliser un script qui interdise les valeurs de type "char" et soit supérieur à 0 J'ai trouvé ce code mais je ne sais pas comment l'appliquer, fonctionne-t-il? <script>
0
2061
by: R2 | last post by:
Hello I am trying to make some custom menus, popups and toolbars. But, at the end of my toolbar I have a down pointing arrow that opens the Toolbar Options dialog box. Can anyone advise on how to remove this? I have tried various combinations on the Toolbar Properties including un checking "allow customization" but nothing I have tried seems to work. Thanks for your time Ralph
3
16063
by: Jorge Gallardo | last post by:
Hola de nuevo a todos... Agradecido a todos los que me habeis solucionado problemas anteriores... Pero como no es novedad, me surge otro. Recientemente buscando, adquiri un codigo para juntar 3 ficheros de texto. El cual adapte para el desarrollo de mi DB. El proceso es genial, pues junto los tres ficheros pulsando solo un boton. (O determinada accion EVENTOS)
1
3366
by: Alex | last post by:
Ciao a tutti, sto sviluppando un applicazione windows, in breve all'interno dello stesso namespace ho un form con una datagrid e un thread che effettua dei controlli e "dovrebbe" caricare i dati sulla datagrid stessa. - nel namespace ho dichiarato un riferimento al form in questo modo: private static Form1 f; - nel form load istanzo e lancio il thread, nel thread eseguo i
3
1934
by: Raphael Tagliani | last post by:
(english version below) Bonjour! Je travaille sur un gros projet java, qui parse beaucoup de fichiers xml au lancement d'un serveur. Nous avons un problème de concurrence qu lancement. En fait, il s'agit d'une erreur Xerces FWK005, et nous sommes incapables de trouver d'où elle provient dans le code. Nous avons déjà essayé de rendre toutes les méthodes qui appellent Xerces synchronized, mais celà
3
2208
by: Burrows | last post by:
HI all turned on VS2005 this morning and had a shock. My Tool Bar has gone hay wire The General tab has renamed itself #13119 and my Report Item Tab has replaced all the reporting controls with text boxes when I chose for a reset all it does is add another text box in the tab. So I reinstalled/repaired VS2005 and the problem has not been fixed does any one know what i have done to mess my system up and more importantly how to rectify the...
2
9062
by: Peri | last post by:
Dear All, Is there a dockable control in VB.NET similar to the Error List Window, Output Window, Soluition Explorer, Tool Box. I would like to have a control that has Pin functionality (Auto Hide) and dockable at any place in the Menu MDI window. Your help in this is greatly appreciated. Thanks and Regards,
4
5402
by: =?ISO-8859-15?Q?Albe_V=B0?= | last post by:
In my Application, I need to make a certain graphical refresh, interrogating SqlServer, only if Application has focus (i.e. the title bar is blue). Interrogating .Focused property of various forms of the project is not the way (maybe, enumerting forms and checking if at least one of them has focus may work, but I don't think this to be the most beautiful solution). Any idea?
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.