lundi 13 février 2017

C# Attribute to detect unused methods

Vote count: 0

Is it possible to write an Attribute that can track methods to detect if those methods are never called?

void MyMethod(){



warning: method "MyMethod" in "MyClass" has no references in code.

It is not strictly necessary to have it run at compile time, but it should work when the application is initialized (better at compile time anyway).

This tag will be putted to track methods on Audio Library, since audio is refactored very frequently and we usually search for audio methods with 0 references in code we want to mark these methods so we can detect quickly and remove unused audio assets.

Basically each time we add a new sound effect, we may later no longer trigger it (calling its method), and the audio file/playback code can remain in the application for a long time.

asked 55 secs ago

Let's block ads! (Why?)

C# Attribute to detect unused methods

Aucun commentaire:

Enregistrer un commentaire