locked
DssEnvironment.Initialize(50000, 50001) failing on WinCE 6.0 device RRS feed

  • Question

  • I have a very simple VS2008 WinCE 5.0 project targeting the .NET v3.5 CF. However, I am not able to instantiate the DSS Runtime Environment within my console app using the DssEnvironment.Initialize(50000, 50001) method as the code appears to run away and I receive the following list of exceptions. Any help with this would be greatly appreciated as I am currently at a stand still...

    *   DssRuntimeLoader: CreateEnvironment[01/01/2006 12:12:35]
    'DssSampleHostingService.exe' (Managed): Loaded 'c:\projects_vs2008\test_apps\dsshostdemoce\dsssamplehostingservice\bin\debug\CF.Microsoft.Ccr.Adapters.WinForms.dll'
    'DssSampleHostingService.exe' (Managed): Loaded 'C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\Debugger\BCL\System.Windows.Forms.dll'
    'DssSampleHostingService.exe' (Managed): Loaded 'C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\Debugger\BCL\System.Drawing.dll'
    A first chance exception of type 'System.IO.IOException' occurred in CF.Microsoft.Dss.Base.dll
    *** Exception loading contract directory state file:System.IO.IOException: Invalid state file:file:///Program Files/store/serviceSearchPaths.xml
       at Microsoft.Dss.Core.DssRuntimeAssemblyNames.LoadAndValidateServiceSearchPaths(String installDir, List`1& paths)
       at Microsoft.Dss.Core.DssRuntimeAssemblyNames.LoadAndValidateServiceSearchPaths(List`1& paths)
       at Microsoft.Dss.Services.Serializer.DataCache.<Initialize>d__6.MoveNext()
       at Microsoft.Ccr.Core.TaskExecutionWorker.MoveIterator(ITask& currentTask, IteratorContext iteratorContext, Handler& finalizer)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTask(ITask& currentTask, DispatcherQueue p, Boolean bypassExecute)
       at Microsoft.Ccr.'DssSampleHostingService.exe' (Managed): Loaded 'System.SR.dll'
    A first chance exception of type 'System.ArgumentNullException' occurred in CF.Microsoft.Dss.Base.dll
    **  Exception processing cache:System.ArgumentNullException: Value can not be null.
    Parameter name: directories
       at Microsoft.Dss.Core.ServiceAssemblyReflection.ContractCacheManager.Process(String cacheFile, ICollection`1 directories)
       at Microsoft.Dss.Services.Serializer.DataCache.<ProcessServiceCacheHandler>d__11.MoveNext()
       at Microsoft.Ccr.Core.TaskExecutionWorker.MoveIterator(ITask& currentTask, IteratorContext iteratorContext, Handler& finalizer)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTask(ITask& currentTask, DispatcherQueue p, Boolean bypassExecute)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecutionLoop()

    A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
    *** Exception during initialize:System.Collections.Generic.KeyNotFoundException: KeyNotFoundException
       at System.ThrowHelper.ThrowKeyNotFoundException()
       at System.Collections.Generic.Dictionary`2.get_Item(String key)
       at Microsoft.Dss.Core.ServiceAssemblyReflection.ContractToAssembliesMap.get_Item(String key)
       at Microsoft.Dss.Services.Serializer.DataCache.<Initialize>d__6.MoveNext()
       at Microsoft.Ccr.Core.TaskExecutionWorker.MoveIterator(ITask& currentTask, IteratorContext iteratorContext, Handler& finalizer)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTask(ITask& currentTask, DispatcherQueue p, Boolean bypassExecute)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecutionLoop()
    A first chance exception of type 'System.IO.IOException' occurred in CF.Microsoft.Dss.Base.dll
    *** Exception loading contract directory state file:System.IO.IOException: Invalid state file:file:///Program Files/store/serviceSearchPaths.xml
       at Microsoft.Dss.Core.DssRuntimeAssemblyNames.LoadAndValidateServiceSearchPaths(String installDir, List`1& paths)
       at Microsoft.Dss.Core.DssRuntimeAssemblyNames.LoadAndValidateServiceSearchPaths(List`1& paths)
       at Microsoft.Dss.Services.Serializer.DataCache.<Initialize>d__6.MoveNext()
       at Microsoft.Ccr.Core.TaskExecutionWorker.MoveIterator(ITask& currentTask, IteratorContext iteratorContext, Handler& finalizer)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTask(ITask& currentTask, DispatcherQueue p, Boolean bypassExecute)
       at Microsoft.Ccr.A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
    *** Exception during initialize:System.Collections.Generic.KeyNotFoundException: KeyNotFoundException
       at System.ThrowHelper.ThrowKeyNotFoundException()
       at System.Collections.Generic.Dictionary`2.get_Item(String key)
       at Microsoft.Dss.Core.ServiceAssemblyReflection.ContractToAssembliesMap.get_Item(String key)
       at Microsoft.Dss.Services.Serializer.DataCache.<Initialize>d__6.MoveNext()
       at Microsoft.Ccr.Core.TaskExecutionWorker.MoveIterator(ITask& currentTask, IteratorContext iteratorContext, Handler& finalizer)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecuteTask(ITask& currentTask, DispatcherQueue p, Boolean bypassExecute)
       at Microsoft.Ccr.Core.TaskExecutionWorker.ExecutionLoop()
    A first chance exception of type 'System.InvalidOperationException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.InvalidOperationException' occurred in CF.Microsoft.Ccr.Core.dll
    The program '[0x6190022] DssSampleHostingService.exe: Managed' has exited with code 0 (0x0).


    Wednesday, July 14, 2010 7:11 PM

Answers

  • It turns out that all of these issues stemmed from the fact that WinCE does not support App.Config files so the DSS runtime configuration was not being automatically generated as it is in a full .NET framework project. To get around this issue, I simply added a "<YourProjectName>.exe.config" file to the project that contained all of the required DSS configuration options (just like in a standard App.config file) then utilized the following code to create the DSS runtime configuration based on the config file settings. The key here is to leverage the DssRuntimeLoader.ParseHostConfigurationFile method to allow the WinCE app to parse the config file.

    In the OnStart method of a Windows Service:

     

    // Configure the DSS runtime using the configuration provided within the App.config file.
    
    
    DssRuntimeConfiguration runtimeConfiguration = new
    
     DssRuntimeConfiguration();
    runtimeConfiguration.HostRootDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    runtimeConfiguration.PublicHttpPort = 50000;
    runtimeConfiguration.PublicTcpPort = 50001;
    
    // Create a list of DSS service manifest files to load using the information provided in the App.config file.
    
    
    String rootFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    List<String> manifestFilesList = new
    
     List<String>();
    manifestFilesList.Add("<PATH TO YOUR SERVICE MANIFEST FILE>"
    
    );
    
    // Initialize the DSS host environment using the provided information.
    
    
    DssRuntimeLoader.ParseHostConfigurationFile("<YOUR CONFIG FILE NAME>"
    
    , runtimeConfiguration);
    DssEnvironment.Initialize(runtimeConfiguration, manifestFilesList.ToArray());
    
    // Wait for the DSS environment to be shutdown.
    
    
    DssEnvironment.WaitForShutdown();
    

     

     

    In the OnStop method of a Windows Service:

     

    // Shutdown the DSS host environment.
    
    
    
    
    DssEnvironment.Shutdown();
    

     

     

    Keith

    Wednesday, August 11, 2010 12:24 PM

All replies

  • Followup: One of the key differences I noted between Windows full .NET framework and WinCE .NET CF development was the lack of support for App.config files in .NET CF apps. I believe this has something to do with the DssEnvironment.Initialize(50000, 50001) method failing since it is unable to obtain the configuration from this file. I have verified that this method does read the App.config information on a similar Windows full .NET application. Can someone please explain to me how the CF.DssHost.exe file has an associated cf.dsshost.exe.config? I have tried to copy a similar config file from my Windows full .NET app but it did not help.

    Also, I am referencing the CCR and DSS R2 assemblies since R3 no longer supports .NET CF.
    Wednesday, July 14, 2010 7:16 PM
  • I was able to make further progress on this issue... I found some information in the DSS user guide that discussed the requirement for the application that is to host DSS services to be stored within a "bin " subfolder so that your deployed directory structure would be as follows: MyProjectName\bin\<code goes here> . Fixing the directory structure now leads to the following set of runtime errors shown below and the resultant message printed to the console "ArbiterCleanup failed during exception handling for failed task ". The good news is that the DssEnvironment.Initialize() method now returns and I can continue project execution. The bad news is that the DSS services don't start. Any further help would be greatly appreciated!

     

    DssRuntimeLoader: CreateEnvironment[01/01/2006 12:18:01]
    'DssSampleHostingService.exe' (Managed): Loaded 'c:\projects_vs2008\test_apps\dsshostdemoce\dsssamplehostingservice\bin\debug\CF.Microsoft.Ccr.Adapters.WinForms.dll'
    'DssSampleHostingService.exe' (Managed): Loaded 'C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\Debugger\BCL\System.Windows.Forms.dll'
    'DssSampleHostingService.exe' (Managed): Loaded 'C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\Debugger\BCL\System.Drawing.dll'
    'DssSampleHostingService.exe' (Managed): Loaded '/program files/dsssamplehostingservice/bin/cf.microsoft.dss.runtime.proxy.dll'
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Dss.Runtime.dll
    A first chance exception of type 'System.NotSupportedException' occurred in CF.Microsoft.Ccr.Core.dll

    Thursday, July 15, 2010 11:52 AM
  • It turns out that all of these issues stemmed from the fact that WinCE does not support App.Config files so the DSS runtime configuration was not being automatically generated as it is in a full .NET framework project. To get around this issue, I simply added a "<YourProjectName>.exe.config" file to the project that contained all of the required DSS configuration options (just like in a standard App.config file) then utilized the following code to create the DSS runtime configuration based on the config file settings. The key here is to leverage the DssRuntimeLoader.ParseHostConfigurationFile method to allow the WinCE app to parse the config file.

    In the OnStart method of a Windows Service:

     

    // Configure the DSS runtime using the configuration provided within the App.config file.
    
    
    DssRuntimeConfiguration runtimeConfiguration = new
    
     DssRuntimeConfiguration();
    runtimeConfiguration.HostRootDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    runtimeConfiguration.PublicHttpPort = 50000;
    runtimeConfiguration.PublicTcpPort = 50001;
    
    // Create a list of DSS service manifest files to load using the information provided in the App.config file.
    
    
    String rootFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    List<String> manifestFilesList = new
    
     List<String>();
    manifestFilesList.Add("<PATH TO YOUR SERVICE MANIFEST FILE>"
    
    );
    
    // Initialize the DSS host environment using the provided information.
    
    
    DssRuntimeLoader.ParseHostConfigurationFile("<YOUR CONFIG FILE NAME>"
    
    , runtimeConfiguration);
    DssEnvironment.Initialize(runtimeConfiguration, manifestFilesList.ToArray());
    
    // Wait for the DSS environment to be shutdown.
    
    
    DssEnvironment.WaitForShutdown();
    

     

     

    In the OnStop method of a Windows Service:

     

    // Shutdown the DSS host environment.
    
    
    
    
    DssEnvironment.Shutdown();
    

     

     

    Keith

    Wednesday, August 11, 2010 12:24 PM