Compile VPL as a Service Bug when using Text Functions Activity

Hi,

I think I have found a bug when trying to compile my VPL as a service when it includes the TextFunctions Activity. The DiagramService.cs source that is code generated is not vaild C#.
To demonstrate, try this very simple VPL:

Code Snippet

+-+ +-+
|Data | LastIndexOf |TextFunctions|
|"Hello World"...................... |
|String | | "a" |
+-+ +-+



Where the Data Connection paramerters are:
Code Snippet

Value Target
-- -
value String
"World" Query
0 StartIndex



When you Build->Compile as a Service, the build log shows:
* generating manifest: C:\dev\HomeControl\vpl\temp\Application.manifest.xml
* Loading Program: file:///C:/Microsoft Robotics Studio (1.5)/43e9c71f-78b8-45bf-a824-b68809480cab/Application.program.xml
* Starting internal DSS Node on ports 50000 and 50001...
* Finding Proxy assemblies for partners...
* http://schemas.microsoft.com/robotics/2006/10/string.html
* Utility.Y2006.M08.Proxy, Version=1.5.507.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
* Processing Activities...
* Activity: program.activity
* A user defined activity.
* Processing Handlers...
* Handler: program.activity.Start+start
* Handler: program.activity.Action
* Creating file: C:\dev\HomeControl\vpl\temp\DiagramTypes.cs
* Creating file: C:\dev\HomeControl\vpl\temp\DiagramService.cs
* Compiling Assembly...
* Compiling...
*** C:\Microsoft Robotics Studio (1.5)\bin> "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"System.dll" /R:"System.Xml.dll" /R:"System.Drawing.dll" /R:"C:\Microsoft Robotics Studio (1.5)\bin\ccr.core.dll" /R:"C:\Microsoft Robotics Studio (1.5)\bin\dssbase.dll" /R:"C:\Microsoft Robotics Studio (1.5)\bin\dssruntime.dll" /R:"C:/Microsoft Robotics Studio (1.5)/bin/Utility.Y2006.M08.Proxy.DLL" /out:"C:\dev\HomeControl\vpl\temp\bin\Application.Y2007.M08.dll" /DBig SmileEBUG /debug+ /optimize- /warnaserror /w:4 /keyfile:"C:/Microsoft Robotics Studio (1.5)/samples/mrisamples.snk" "C:\dev\HomeControl\vpl\temp\DiagramService.cs" "C:\dev\HomeControl\vpl\temp\DiagramTypes.cs"
* Creating project file...
***
***
*** Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
*** for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
*** Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
***
*** c:\dev\HomeControl\vpl\temp\DiagramService.cs(20,7): error CS1041: Identifier expected, 'string' is a keyword
*** c:\dev\HomeControl\vpl\temp\DiagramService.cs(44,15): error CS1519: Invalid token '.' in class, struct, or interface member declaration
*** c:\dev\HomeControl\vpl\temp\DiagramService.cs(44,64): error CS1526: A new expression requires () or [] after type
*** c:\dev\HomeControl\vpl\temp\DiagramService.cs(201,29): error CS1519: Invalid token '.' in class, struct, or interface member declaration
*** Compilation Failed!
*** Failed!
What appears to be the problem is that an invalid "using" statement is generated:

using string = Microsoft.Robotics.Services.Sample.StringHelper.Proxy;

As you can see the reserved work "string" is used as an alias name!

Is there a work-around for this? I am using MSRS 1.5 Released version.

Any help is much appreciated.

[4232 byte] By [ReeceR] at [2008-2-25]
# 1

Hi,

this is indeed a bug.

The alias is picked up from the contract identifier of the service (which in this case ends with /string.html). Unfortunately we do not catch that string is a keyword when creating the alias.

There are two work arounds:

1) The proper way: In samples\Misc\Utility open Utility.csproj. Copy the entire StringHelper directory. In the copied files change the namespace and the service class name to "MyStringHelper" (or something you like better). Change the filenames of the images accordingly. In the Contract class change the value of the identifier to end with "mystring.html". Change the display name (and description) of the service to make sure that you can tell your new service apart from the old one. Recompile the project. You now have a new service with the same functionality.

2) The easy way: In samples\Misc\Utility open Utility.csproj. In the Contract class change the value of the identifier to end with "mystring.html". Recompile.

In both case you have to change your diagram to use the new (1) or updated (2) service.

If you don't have to interoperate with other code go for 2) Otherwise 1) is the safe solution because it makes sure that the old string service is still there.

We are working on a fix for this issue. Sorry for the inconvenience.

Hope this helps,

Andreas

AndreasUlbrich at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Visual Programming Language...

Microsoft Robotics Studio

Site Classified