JasperFx / baseline

Grab bag of generic utilities and extension methods for .Net development
Apache License 2.0
110 stars 21 forks source link

CallingAssembly.findAssembly Assumes Assembly Name Matches Namespace #22

Open twinter-amosfivesix opened 3 years ago

twinter-amosfivesix commented 3 years ago

CallingAssembly.findAssembly() uses a stack trace to find the calling assembly. Stack traces have namespaces in them. The code assumes the namespace matches the assembly name. If the calling assembly's assembly name does not match the namespace, it won't be found.

OK yeah, why would anyone do this? It was really just an intermediate step in some refactoring where I discovered this. So it will go away for me. I really just wanted to make sure I was understanding this correctly, as it sucked up a few hours. Thanks! :-)

https://github.com/JasperFx/baseline/blob/master/src/BaselineTypeDiscovery/CallingAssembly.cs#L75