<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Project Geometry Service Failed event - UserState object type does not match in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501782#M12851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using a geometry service's ProjectAsync method to project some graphics in an application, and I am passing the graphic layer name as a string using the userToken parameter:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;GeometryService ProjectShapefileService = new GeometryService(_geometryServiceUrl);
ProjectShapefileService.ProjectCompleted += ProjectShapefileService_ProjectCompleted;
ProjectShapefileService.Failed += ProjectShapefileService_Failed;
ProjectShapefileService.ProjectAsync(thisShapefileGraphics, _map.SpatialReference, shapefileName);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works fine, except that when the project operation fails the UserState object that is returned via the Failed event (within the args object) does not match the type of the userToken parameter (in this case it is not a string). Instead it is a generic object array (see attached screenshot for debugging example).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private void ProjectShapefileService_Failed(object sender, TaskFailedEventArgs args)
{
 // This is what I need to do to get to the graphics layer name (passed via the userToken parameter)
 object[] thisUserState = (args.UserState as object[])[0] as object[];
 string thisShapefileName = thisUserState[2] as string;
 // If this worked like other geometry service methods, I should be able to do this instead. Why not?
 //string thisShapefileName = args.UserState as string;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there an easier way to get to the userToken parameter that was passed to the geometry service?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Nov 2011 04:24:03 GMT</pubDate>
    <dc:creator>AndrewBiggins</dc:creator>
    <dc:date>2011-11-23T04:24:03Z</dc:date>
    <item>
      <title>Project Geometry Service Failed event - UserState object type does not match</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501782#M12851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using a geometry service's ProjectAsync method to project some graphics in an application, and I am passing the graphic layer name as a string using the userToken parameter:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;GeometryService ProjectShapefileService = new GeometryService(_geometryServiceUrl);
ProjectShapefileService.ProjectCompleted += ProjectShapefileService_ProjectCompleted;
ProjectShapefileService.Failed += ProjectShapefileService_Failed;
ProjectShapefileService.ProjectAsync(thisShapefileGraphics, _map.SpatialReference, shapefileName);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works fine, except that when the project operation fails the UserState object that is returned via the Failed event (within the args object) does not match the type of the userToken parameter (in this case it is not a string). Instead it is a generic object array (see attached screenshot for debugging example).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private void ProjectShapefileService_Failed(object sender, TaskFailedEventArgs args)
{
 // This is what I need to do to get to the graphics layer name (passed via the userToken parameter)
 object[] thisUserState = (args.UserState as object[])[0] as object[];
 string thisShapefileName = thisUserState[2] as string;
 // If this worked like other geometry service methods, I should be able to do this instead. Why not?
 //string thisShapefileName = args.UserState as string;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there an easier way to get to the userToken parameter that was passed to the geometry service?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 04:24:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501782#M12851</guid>
      <dc:creator>AndrewBiggins</dc:creator>
      <dc:date>2011-11-23T04:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Project Geometry Service Failed event - UserState object type does not match</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501783#M12852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Seems to be a bug. We'll try to get it fix in a future version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that your workarond looks good for now but will fail when the bug is fixed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for reporting that.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 09:03:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501783#M12852</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2011-11-23T09:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Project Geometry Service Failed event - UserState object type does not match</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501784#M12853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Dominique,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this a bug in the Silverlight API or in ArcGIS Server? I'm asking because I'm wondering when this bug might be fixed (and I'm hoping it is in the Silverlight API because then it might be fixed sooner!).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2011 00:09:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501784#M12853</guid>
      <dc:creator>AndrewBiggins</dc:creator>
      <dc:date>2011-11-24T00:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Project Geometry Service Failed event - UserState object type does not match</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501785#M12854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's a bug in the Silverlight API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You are lucky:)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Nov 2011 06:50:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501785#M12854</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2011-11-24T06:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Project Geometry Service Failed event - UserState object type does not match</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501786#M12855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is Silverlight API bug fixed? or there are any work around for this to fix, reply here. Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Nov 2013 07:34:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501786#M12855</guid>
      <dc:creator>SurajKoneri</dc:creator>
      <dc:date>2013-11-08T07:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Project Geometry Service Failed event - UserState object type does not match</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501787#M12856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi guys,&lt;BR /&gt;&lt;BR /&gt;Is Silverlight API bug fixed? or there are any work around for this to fix, reply here. Thanks.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;The bug will be fixed in the next release (which should be released soon).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew shared a workaround in his first post.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Nov 2013 07:49:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/project-geometry-service-failed-event-userstate/m-p/501787#M12856</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2013-11-08T07:49:29Z</dc:date>
    </item>
  </channel>
</rss>

