473,387 Members | 1,295 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2079
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.com

"Venkat" <st******@palantirsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP02.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.com> wrote in message
news:67**********************************@microsof t.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******@palantirsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP02.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
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 ";'. ...
10
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...
3
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é...
0
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...
3
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...
1
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...
3
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...
3
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...
2
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...
4
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.