You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is something that may seem suspicious at first but I thought it'd be interesting to share since I'm planning to use it for my personal use cases.
Long story short, I just found out about the DisassemblyDiagnoser and figued it'd be a great way to easily take a look at the inner methods I'm testing. This requires using the recursiveDepth parameter to DisassemblyDiagnoserAttribute, but for my use case, it has the downside of pulling in a good chunk of the code from System.Collections.Generic.List<T>. This isn't exactly useful, nor of interest to me, so I figured a good compromise would be to exclude given namespaces.
A couple considerations:
This is not exactly pretty in the sense that it is done in such a way that "exclusion does not prevent traversal": Methods within the excluded namespaces are still processed, in case they call in namespaces that are not excluded, but they are simply not added to the output list for XML serialization by the disassemblers.
This is an opt-in feature; by default, no namespace is excluded.
Namespace detection is done through IL whenever applicable. If not, I chose to resort to signature parsing, which is not exactly pretty, but does a good enough job. I'm open to suggestions in regards to improving this.
The benchmarks themselves are placed in a pseudo null namespace, which acts as a wildcard "process me" value.
Known possible improvements:
Pattern matching. Would easily exclude System.*. Or go full regex.
I would have provided this as a pull request from the start but I think it's better to discuss it first - I'm also having trouble getting NuGet to restore all the packages. I have really crappy internet so that might be on my end - which means I also can't currently test any of this. Excerpt from nuget log:
The feed 'api.nuget.org [https://api.nuget.org/v3/index.json]' lists package 'System.Diagnostics.Debug.4.0.11-rc2-24027' but multiple attempts to download the nupkg have failed.
I am afraid that this feature would be used by a very few people and would definitely increase the complexity of DissasemblyDiagnoser which already is quite high.
I think that we can make WindowsDisassembler public and you can just reuse it in your code and filter the DisassemblyResult which it produces. So you should be able to write your own diagnoser that does that with 10-20 lines of code. Is that OK?
@Warpten I made the WindowsDisassembler type and methods public. You should be able to write your own diagnoser now and reuse it. Please let me know if something is missing or just send a PR.
This is something that may seem suspicious at first but I thought it'd be interesting to share since I'm planning to use it for my personal use cases.
Long story short, I just found out about the
DisassemblyDiagnoser
and figued it'd be a great way to easily take a look at the inner methods I'm testing. This requires using therecursiveDepth
parameter toDisassemblyDiagnoserAttribute
, but for my use case, it has the downside of pulling in a good chunk of the code fromSystem.Collections.Generic.List<T>
. This isn't exactly useful, nor of interest to me, so I figured a good compromise would be to exclude given namespaces.A couple considerations:
null
namespace, which acts as a wildcard "process me" value.Known possible improvements:
System.*
. Or go full regex.I would have provided this as a pull request from the start but I think it's better to discuss it first - I'm also having trouble getting NuGet to restore all the packages. I have really crappy internet so that might be on my end - which means I also can't currently test any of this. Excerpt from nuget log:
Anyways, the patch:
https://gist.github.com/Warpten/c8f0d809f346684401df89ab85139cd9
The text was updated successfully, but these errors were encountered: