Archived

This forum has been archived. Please start a new discussion on GitHub.

Unable to load .NET dll

Hi,

I'm trying out iceboxnet. In the instructions it said that as long as the dll for the service is in PATH, it should be able to find the dll.

So here's my PATH
D:\Ice-3.3.1-VC90>echo %PATH%
C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\PHP\;C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Java\jdk1.6.0_16\bin;C:\Program Files\stunnel;C:\bin;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\bin;C:\Program Files\QuickTime\QTSystem\;D:\sgs-server-dist-0.9.7\sgs-server-0.9.7\;C:\Program Files\TortoiseSVN\bin;C:\Qt\4.4.0\bin;D:\apache-ant-1.7.1\bin;C:\Program Files\Windows Imaging\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;D:\jboss\jboss-5.1.0.GA\bin;D:\Ice-3.3.1-VC90\bin;D:\Ice-3.3.1-VC90\bin;C:\Program Files\TortoiseHg;D:\Ice-3.3.1-VC90\services;C:\Program Files\CVSNT\


The red bold text is where my hello.dll is but I'm getting this still
10/2/2009 15:11:33:240 CSharpIceBoxServer1: error: IceBox.FailureException
    reason = "ServiceManager: unable to load service 'hello.dll:HelloServiceI': unable to load assembly: hello.dll"
   at IceBox.ServiceManagerI.startService(String service, String entryPoint, String[] args) in d:\builds\distbuilds\release\Ice-3.3.1\cs\src\IceBox\ServiceManagerI.cs:line 551
   at IceBox.ServiceManagerI.run() in d:\builds\distbuilds\release\Ice-3.3.1\cs\src\IceBox\ServiceManagerI.cs:line 406
Caused by: System.IO.FileNotFoundException: Could not load file or assembly 'hello.dll' or one of its dependencies. The system cannot find the file specified.

Thanks
Budyanto

Comments

  • xdm
    xdm La Coruña, Spain
    Hi,

    You can use dependency walker to find what dll is failing to load.

    Bests,
    José
  • Hmmm it's dwmapi.dll. Is any of the ice dlls dependent on it?
  • So the dependency on dwmapi.dll is a delay load dependency. I setup my C# project in visual studio as a class library, I assumed this is the right one as I'm creating a DLL for ICE service.

    According to some posts online the missing delay load dependency should be ok on a non-vista box (I'm running on XP) because nothing would ever call anything exported by dwmapi.dll.

    I tried the dependency walker on some other executables (notepad.exe) and it has the same missing dependency on dwmapi.dll but it loaded fine. I'm wondering why iceboxnet couldn't load the dll.

    Thanks
    Budyanto
  • xdm
    xdm La Coruña, Spain
    Hi,

    Ice libraries doesn't dependends on dwmapi.dll.

    In dependecy walker , you can see what dll depends on dwmapi.dll, using the left frame tree.

    I have read about similar problems with dwmapi in msdn forums and seems something wrong with your windows setup.

    What .NET and windows version are you using? could you reproduce that in a different windows machine?

    If you have a small example to reproduce the issue, i will take a look.

    Cheers,
    José
  • I'll try to run it on another windows machine.

    I'm running Windows XP SP2 and Visual Studio 2008, .Net framework 3.5 SP1.

    Here's the dependency chain that leads to dwmapi.dll. The service dll is hello.dll.

    hello.dll-->mscoree.dll-->advapi32.dll-->secur32.dll-->netapi32.dll-->dnsapi.dll-->iphlpapi.dll-->mprapi.dll-->setupapi.dll-->shell32.dll-->shdocvw.dll-->mshtml.dll-->dwmapi.dll

    I have a Visual Studio 2008 solution that I can let you try. How do I give that to you?

    Thanks
    Budyanto
  • xdm
    xdm La Coruña, Spain
    Hi
    I have a Visual Studio 2008 solution that I can let you try. How do I give that to you?

    clean the solution, do a zip file and attach it here. I will give it a try.

    José
  • Please find the Visual Studio 2008 solution attached.

    I'm running it in an icegrid configuration.

    Here's my server template
    <server-template id="CSharpServerTemplate">
             <parameter name="index"/>
             <icebox id="CSharpIceBoxServer${index}" activation="on-demand" exe="iceboxnet">
                   <service-instance template="CSharpHelloServiceTemplate"/>
             </icebox>
    </server-template>
    

    Here's the service template
    <service-template id="CSharpHelloServiceTemplate">
             <service name="HelloService" entry="hello.dll:hello.HelloServiceI">
                <properties>
                   <property name="Hello.Identity" value="hello"/>
                </properties>
                <adapter name="${service}" endpoints="tcp" id="${server}.${service}" replica-group="HelloServiceAdapters"/>
             </service>
    </service-template>
    

    and here's the node
    <node name="node1">
             <server-instance template="CSharpServerTemplate" index="1"/>
    </node>
    


    Thanks
    Budyanto
  • xdm
    xdm La Coruña, Spain
    Hi Budyanto,

    The problem is that being the dll in the PATH is not enough for iceboxnet to load it.

    You could change your configuration to use an absolute path
    <service-template id="CSharpHelloServiceTemplate">
             <service name="HelloService" entry="D:\Ice-3.3.1-VC90\services\hello.dll:hello.HelloServiceI">
                <properties>
                   <property name="Hello.Identity" value="hello"/>
                </properties>
                <adapter name="${service}" endpoints="tcp" id="${server}.${service}" replica-group="HelloServiceAdapters"/>
             </service>
    </service-template>
    

    If you use a relative path it will be relative to the path from where iceboxnet is started.

    If the file is not located by this meanings, it is load from system so in windows it should be in GAC, or it should use a exe.config for iceboxnet.exe

    That being say i think that during development is best to have and absolute path in your configuration.

    Later you could look if install to GAC is appropriate for your project.

    We will improve the documentation of how this work.

    Regards,
    José
  • Oh...ok.

    I tried specifying the full path

    entry="D:\Ice-3.3.1-VC90\services\hello.dll:hello.HelloServiceI"

    It's not happy with the colon after D. It treats ti as a delimiter for the interface name. Is there a way to escape it?

    Thanks
    Budyanto
  • xdm
    xdm La Coruña, Spain
    Hi Budyanto,

    There is a problem with using absolute paths on windows with iceboxnet.

    the colon character in the absolute path will confuse iceboxnet about the assembly name, and there is currently no way to scape it ':'.

    So in windows you should use a relative path to the directory from where iceboxnet is started, or do GAC installation of the assembly.

    We will fix this with the next release so absolute paths could work on windows too.

    Thanks for point this out,
    José
  • Thanks very much for your help.

    I'm finally able to run it.

    Budyanto