Select to view content in your preferred language

Stomped by issue with WPF userControl referencing WPFToolkit.dll

1372
3
11-29-2010 08:53 PM
PierreCusteau
New Contributor
Hi everyone,

I've been banging my head on this one for a couple days and would appreciate anyone's input:

I built this UserControl for use within an existing WinForms based application. My control works fine in various environments including a prototype WinForms app that hosts the control in an ElementHost control.

Now I need to insert this control into a WinForms application that requires strong name assemblies. Everything with my control appears to work fine until there is a need to display symbols. Using CustomMarkerSymbol or PictureMarkerSymbols will invariably throw this error:

[INDENT]Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Windows.Markup.XamlParseException: Could not load file or assembly 'WPFToolkit' or one of its dependencies. An argument was out of its legal range. (Exception from HRESULT: 0x80131502) Line '24' Position '46'. ---> System.IO.FileLoadException: Could not load file or assembly 'WPFToolkit' or one of its dependencies. An argument was out of its legal range. (Exception from HRESULT: 0x80131502)
File name: 'WPFToolkit' ---> System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)[/INDENT]


As you can see, the code is complaining about problems with loading the WPFToolkit.dll assembly.

I am using the ESRI ArcGIS Client Toolkit version 1.2 with the latest WPF Toolkit from Codeplex. I've tries several things including using previous version of the WPF Toolkit, signing and recompiling the WPFToolkit assembly etc...

All of my assemblies are copied to a folder where the WinForms host app is expecting controls to be dropped.

Again any help with this would be much appreciated.


PC
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
I think the first thing you need to do is fix the assembly references. Check that the file path indeed points to the proper location.

If you are working with API v 1.2, look to see that you've met all these installation requirements: http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/index.html
0 Kudos
PierreCusteau
New Contributor
Thanks Jennifer,

I do have all the prereqs installed and as I mentionned, this control works fine when used in a WinForms test application. It just doesn't work when hosted within this particular 3rd party app that requires strong name assemblies.

I have my project copy all referenced assemblies locally. Here they are:

ESRI.ArcGIS.Client, Version=1.2.0.177
ESRI.ArcGIS.Client.Behaviors, Version=1.2.0.177
ESRI.ArcGIS.Client.Bing, Version=1.2.0.177
ESRI.ArcGIS.Client.Toolkit, Version=1.2.0.177

System.Core, Version=3.5.0.0
System.Runtime.Serialization, Version=3.0.0.0
System.Xml.Linq, Version=3.5.0.0
WindowsBase, Version=3.0.0.0
PresentationCore, Version=3.0.0.0
PresentationFramework, Version=3.0.0.0
System, Version=2.0.0.0
System.Xml, Version=2.0.0.0

WPFToolkit, Version=3.5.40128.1 --> This is actually the February release of the WPF Toolkit that I signed and recompiled in attempting to address this issue.

Now, my project does not use any of the tools or behaviors from the WPF toolkit so I'd like to better understand what the dependencies are between the ESRI.ArcGIS.Client asssembly and the WPF Toolkit, maybe I'm using the wrong version of the latter? Btw, I'm also not using any of the assemblies from the ESRI.ArcGIS.Client.Toolkit either at this point.

Thanks for your help

Pierre
0 Kudos
JenniferNery
Esri Regular Contributor
API v1.2 uses WPF Toolkit v3.5.50211.1.

You may be right that the version mismatch may cause this issue.
0 Kudos