Cleanup incorrectly removing valid namespaces

I've noticed some new behavior recently in some of our more commonly-used scripts. We maintain a library of support scripts for our support staff and they all link to a common shared DLL folder. In doing some cleanup, I'm having the support staff remove obsolete references. However, when they then use the Cleanup link on the Additional Namespace Imports, it is recommending the removal of namespaces that are valid and necessary for the current script. I don't remember this problem occurring until maybe 1-2 months ago.

I also notice when I click the "Pick from Assemblies" option, and click on the relevant DLL, no namespaces show in the list in the bottom, although they are certainly there. Perhaps this is related? Is there a way to troubleshoot why LINQPad is not correctly detecting the namespaces present in some custom-made assemblies?



  • There is a bug whereby references from 'My Extensions' aren't considered during cleanup. Could this be the case? (If so, it's fixed in the latest beta.)
  • No, we don't use My Extensions. I found the log file, and it looks like if a DLL is dependent on another 3rd-party DLL that is not included, the namespace resolution fails completely. For instance here is a message in the Log file:

    5.36.03 2019-03-28T11:45:15.9371790-04:00 AssemblyProber.GetNamespaces -
    FileNotFoundException: Could not load file or assembly 'EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
    at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
    at System.Reflection.RuntimeAssembly.GetExportedTypes()
    at LINQPad.Reflection.AssemblyProber.NamespaceInspector.GetNamespaces(String assemblyPath)
    First chance data:

    I don't think that used to be the behavior, but I could be wrong. I think this is unexpected behavior. I would expect to be informed of missing referenced DLL's in the UI, or ignore them for purposes of listing all namespaces.

Sign In or Register to comment.