Failed creating service!
Hi all,
I'm getting "Failed to create service..." error when I try creating a lego nxt brick service here:
Code Snippet
dss.CreateService("http://schemas.microsoft.com/robotics/2006/05/legonxt.html");
(as well as legonxt service is failed to be created when starting the Robotics Tutorial 1, it used to be working perfect)
I've initialized the DssEnvironment, and that code worked for a while till I included in my project references to the LegoNXT and LegoNXTService dlls...
My project is built in the MSRS \bin directory, I think the "Copy local=true" property of the referenced lego dlls caused the problem, as it replaced the original dlls ... actually with themselves!
any suggestions are appreciated
Thank you,
please include any debug output or any console output. Are you using MSRS 1.0? if so make sure the dlls only exist in one place, not in bin and bin\services.
If using MSRS 1.5, everything should be in \bin. To make sure recompile the legoNXT solution so all services are of the right version
Hi George,
Here is part of the output when I try running Robotics Tutorial 1:
Code Snippet
* Service uri: [05/03/2007 02:34:50][http://moham:50000/directory]
* Service uri: [05/03/2007 02:34:53][http://moham:50000/constructor/61a1cf0e-
e5ff-4b9f-9484-f8a1b263d264]
* Starting manifest load: file:///D:/Microsoft%20Robotics%20Studio%201.5%20(CT
P%20April%202007)/samples/config/LEGO.NXT.MotorTouchSensor.manifest.xml [05/03/2
007 02:35:00][http://moham:50000/manifestloaderclient]
*** Error creating service type http://schemas.microsoft.com/robotics/2006/05/le
gonxt.html. Fault:Service not found: http://schemas.microsoft.com/robotics/2006/
05/legonxt.html [05/03/2007 02:35:25][http://moham:50000/constructor/61a1cf0e-e5
ff-4b9f-9484-f8a1b263d264]
*** Manifest Loader: Creating service failed: http://schemas.microsoft.com/robot
ics/2006/05/legonxt.html.
Reason: Service not found: http://schemas.microsoft.com/robotics/2006/05/legonxt
.html [05/03/2007 02:35:25][http://moham:50000/manifestloader/564a2669-8b90-49c7
-949c-14399a8d08cd]
...
That happened to me with MSRS 1.0, but then I replaced the lego assemblies with a backup I had and worked fine ... that didn't work for 1.5 (as well as I tried rebuilding the LEGO.NXT solution, but nothing)
I'm working with MSRS 1.5, and deleted the "services" folder created once because I was working with 1.0
Thank you 
Just to clarify, service implementations must be compiled againt MSRS 1.5 in order to be loaded by the MSRS 1.5 runtime. If you developed your LEGO services for 1.0 then you can migrate them to 1.5 using the DssProjectMigration tool. You can find information on how to do this online [1]
Henrik
[1] http://msdn2.microsoft.com/en-us/library/bb417276.aspx
Hi Henrik,
I'm using the LEGO assemblies compiled in MSRS 1.5, I've faced the failure issue since I added references to LEGO assembles in my project ... here I got "Failed creating service.." for LegoNXT brick, and Robotics Tutorial 1 failed too for creating that service (output mentioned in my last msg)
Another two issues I noticed,
- The DssInfo utility is printing:
Code Snippet
Reflecting: RoboticsCommon.dll
*** Error: Unable to cast object of type 'Microsoft.Dss.Core.Attributes.ServiceD
eclarationAttribute' to type 'Microsoft.Dss.Core.Attributes.ServiceDeclarationAt
tribute'. at Microsoft.Dss.Services.ContractManager.ReflectionManager.ParseAs
semblyAttributes(AssemblyNode assem, DssAssemblyReference asmRef, Verbosity verb
oseSettings)
at Microsoft.Dss.Services.ContractManager.ReflectionManager.ParseAssemblyRefe
rence(AssemblyReference asmReference, Int32 nskey, Verbosity verboseSettings, St
ring defaultAssemblyPath)
at Microsoft.Dss.Services.ContractManager.ReflectionManager.ParseAssemblyNode
(AssemblyNode asmNode, Int32 assemblyKey, Verbosity verboseSettings)
at Microsoft.Dss.Services.ContractManager.ReflectionManager.ParseContractFrom
Assembly(String assemblyPath, Boolean relaxedRules, Verbosity verboseSettings, I
nt32& errorCount)
When I try:
Code Snippet
DssInfo bin\RoboticsCommon.dll
- There are two files named "contractDirectoryCache.xml" one in the "store" folder (that's full of assembly and contract names) ... the other is in "\bin\store" which contains only:
Code Snippet
<?xml version="1.0"?>
<DssServiceList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/robotics/2006/01/contractdirectory.html">
<AssemblyBaseDictionarySerialization />
<ServiceComboSerializationContext />
</DssServiceList>
Thank you

,
waiting any suggestions ... cuz that's really delaying my work

I think the LEGO assemblies you reference somehow link to the old version of the runtime. The error message in your output
Code Snippet
Unable to cast object of type 'Microsoft.Dss.Core.Attributes.ServiceDeclarationAttribute' to type 'Microsoft.Dss.Core.Attributes.ServiceDeclarationAttribute'.
is a result of CLR not being able to match up the type referenced in one assembly with the type defined in another assembly even though the types look the same. If the assemblies but referred to exactly the same type they would be able to hook up fine but here they don't.
If you try and start your project from inside the VS debugger (open the solution in VS and hit F5 -- explained in more detail in the various service tutorials) then you will likely see error messages in the Output window (available from the Debug menu on the ) to this effect. You should see the same output as you see in the Microsoft Robotics Studio Command Prompt but interspersed with messages regarding which DLLs are loaded etc.
The only way around this is to double check that all your assemblies in fact are recompiled and up to date linking against the 1.5 runtime.
Let me know how this goes.
Henrik