0

In extension to this question

I want to find out if there is any way where we can identify all the useless methods in WCF service.

It doesn't have to be any tool/app, but I need ideas to perform the cleanup.

ashveli
  • 248
  • 6
  • 28
  • this could help: https://stackoverflow.com/questions/42205644/c-sharp-attribute-to-detect-unused-methods – vhr Dec 14 '22 at 10:24

1 Answers1

0

If your wcf service is in VS, you can try the VS built-in feature for clearing unused code:

Right-click your solution, click analyze and code cleanup, click configure code cleanup, and select unused code. Then run code cleanup after you've configured it.

It may be able to help you remove unused methods or parameters.

Update:

If you want to know which methods are called by the client and how many times, you can add the name of the method call and how many times to the code and store it in the database.

Jiayao
  • 510
  • 3
  • 7
  • thank you, but it doesn't work in this case as we are consuming the methods from client and we don't know if the method is used in client or not. – ashveli Dec 15 '22 at 11:04
  • 1
    You mean you want to know which methods have been called by the client. If you can modify the server-side code, you can make a count of the number of times the method is called and store the data in the database. – Jiayao Dec 16 '22 at 09:26
  • 1
    oohhh... thats a good idea, I think you can post as an answer. – ashveli Feb 07 '23 at 07:45