Problem running scsf apps from network

Topics: CAB & Smart Client Software Factory
Jun 19, 2007 at 6:41 PM
Hi everyone, our first SCSF application is about to deploy to production finally. Yeah! However, I discovered that they don't run their apps from the desktop, they run them from a network share and using caspol sort of like this:

caspol -q -m -ag test -URL \\server\path\* FullTrust -n name

This appears to have worked fine for the other apps they run. However, when I run my app, I get the following error that I've trapped:

2007-06-19 10:56:37.0471|Error|MyApp.Infrastructure.Shell.ShellApplication|Infrastructure.Library
Assembly file \\server\path\file:\\server\path\myapp.exe was not found.
at MyApp.Infrastructure.Library.Services.DependentModuleLoaderService.GuardLegalAssemblyFile(IModuleInfo modInfo)
at MyApp.Infrastructure.Library.Services.DependentModuleLoaderService.LoadAssemblies(IModuleInfo[] modules)
at MyApp.Infrastructure.Library.Services.DependentModuleLoaderService.InnerLoad(WorkItem workItem, IModuleInfo[] modules)
at MyApp.Infrastructure.Library.Services.DependentModuleLoaderService.Load(WorkItem workItem, Assembly[] assemblies)
at Microsoft.Practices.CompositeUI.CabApplication`1.ProcessShellAssembly()
at Microsoft.Practices.CompositeUI.CabApplication`1.Run()
at MyApp.Infrastructure.Shell.ShellApplication.RunInReleaseMode()
at MyApp.Infrastructure.Shell.ShellApplication.Main()
Microsoft.Practices.CompositeUI.Services.ModuleLoadException Assembly file

Just like that except with the real server and path info in it. What I discovered is that if I map a drive it works just fine, but if I run from the unc share I get this error. But I don't want to force everyone to map drives if I don't have to.

I'm thinking this doesn't actually have anything to do with SCSF, but rather reflection, and was wondering if anyone had seen this before?



Jun 19, 2007 at 9:47 PM
The problem seems to lie in DependentModuleLoaderService
private string GetModulePath(string assemblyFile)
if (!Path.IsPathRooted(assemblyFile))
assemblyFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assemblyFile);

return assemblyFile;
Jun 19, 2007 at 9:51 PM
Oops, I didn't hit reply, but it posted anyway. Well anyway, disregarding the formatting that's where the problem is happening, GetModulePath is getting a uri ("file://....") and combining it with the assembly file.

Not sure how to work around this other than modifying this class to work with uris. Can anyone tell me if this changed in the new version?
Jun 19, 2007 at 10:57 PM
Investigating further, I discovered that if I changed ModuleInfo from this:

public ModuleInfo(Assembly assembly)
Guard.ArgumentNotNull(assembly, "assembly");

this.assemblyFile = assembly.CodeBase.Replace("file:///", "").Replace('/', '\\');

to this:

public ModuleInfo(Assembly assembly)
Guard.ArgumentNotNull(assembly, "assembly");

this.assemblyFile = assembly.CodeBase.Replace("file:///", "").Replace(@"file://", "\\\\").Replace('/', '\\');

then it seemed to work fine. Hope this helps somebody someday...
Sep 5, 2007 at 1:50 AM
I encounter this same problem, where can I find the ModuleInfo method that you changed?