Namespaces not loading from some assemblies
I am not sure if this has been asked or not. I tried searching but could not find an answer. We have a few custom assemblies that we are testing in Linqpad 5.52.01 (any CPU). We cannot get some of the assemblies to display their namespaces in the namespace selector in Linqpad. The list comes up empty. These are all .Net Framework 4.8.1 assemblies, and at this point, I am confused about what might be stopping these namespaces from showing up.
Any insight into this would be greatly appreciated.
Thanks
Comments
That would happen if Linqpad was unable to load the assembly for some reason. I don't think you get a visible error until you try to run your script, but I think you should see an error in the logs which I think should be located in %localappdata%\LinqPad\Logs\log.txt
It could also happen if there were no public classes in the assembly. (I know that would be extremely unusual, but it is possible.)
Not sure of the exact mechanism of how LinqPad detects the namespaces, but I suspected it would be something like calling GetExportedTypes() so what happens if you run
When I do your example to get the namespaces, it works fine. However, I thought I figured it out. One of my assemblies was not strongly typed (Signed). However, even after signing it and recompiling it, LinqPad could not list the namespaces for that assembly, Assembly.LoadFile().GetExportedTypes()... does work and lists the namespaces in the assembly.
Also, I opened the assembly with JetBrains dotPeek, which shows all the namespaces. Maybe a bug in Linqpad 5.52.01?