PicoContainer
  1. PicoContainer
  2. PICO-252

NanoContainer.Script.FrameworkCompiler.AddAssembliesFromWorkingDirectory() does not work with web applications and references unmanaged assemblies

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: PicoContainer.NET
    • Labels:
      None
    • Environment:
      Windows XP
    • Number of attachments :
      0

      Description

      AddAssembliesFromWorkingDirectory uses Directory.GetCurrentDirectory(). For a web application, that's the current directory of the server process which is */System32 folder not the application path of the web app. Things get worse, the function assumes anything with a *.dll is a managed assembly and is added to the compiler parameters.

      In its current state, NanoContainer.NET cannot be used for web applications. It would also probably cause undetectable issues if the CurrentDirectory() was somehow changed while a non web-application is running.

      To reproduce:

      Create a web application and break any where. Type in the command window ?Directory.GetCurrentDirecory() to see */System32 as folder.

        Activity

        Michael Ward made changes -
        Field Original Value New Value
        Assignee Michael Ward [ mward ]
        Hide
        Michael Ward added a comment -

        No longer searching current working directory for *.dll files. PicoContainer.dll and NanoContainer.dll are now the only assemblies referenced "magically" by default.

        Assemblies that need to be referenced for use in the script must be named and passed in the assemblies parameter see example ...

        StringCollection assemblies= new StringCollection();
        sc.Add("NanoContaer.Tests.dll ");
        builder.BuildContainer(simpleReference, parentReference, assemblies);

        Show
        Michael Ward added a comment - No longer searching current working directory for *.dll files. PicoContainer.dll and NanoContainer.dll are now the only assemblies referenced "magically" by default. Assemblies that need to be referenced for use in the script must be named and passed in the assemblies parameter see example ... StringCollection assemblies= new StringCollection(); sc.Add("NanoContaer.Tests.dll "); builder.BuildContainer(simpleReference, parentReference, assemblies);
        Michael Ward made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]

          People

          • Assignee:
            Michael Ward
            Reporter:
            Mario Gutierrez
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: