This project has moved. For the latest updates, please go here.

CheckComboBox in VS 2013 Package: Could not load file or assembly

Aug 6, 2015 at 6:19 AM
I am developing a Visual Studio 2013 Package.

I've used NuGet to get the Extended WPF Toolkit and added a CheckComboBox to one of my UserControl.

When I debug the VS Experimental Hive, the user control cannot load because an exception is shown in the XAML editor, right before the CheckComboBox declaration.

The declaration:
<UserControl
    x:Class="EditorControl"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
    ...
    />

<xctk:CheckComboBox
    Delimiter=";"
    ItemsSource="{Binding ApplicabilityValues}"
    SelectedValue="{Binding Applicability}"
    SelectedItemsOverride="{Binding SelectedItems}"
    />
The exception:
XamlParseException

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

Additional information: Could not load file or assembly 'Xceed.Wpf.Toolkit, PublicKeyToken=3e4669d2f30244f4' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
The inner exception
ArgumentException

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Things I tried so far:
  • I've added all Extended WPF Toolkit libraries in the .vsixmanifest file as Assets, so now the libraries are added to the solution itself and they are marked with CopyAlways=True and BuildAction=Content, but the exception stays.
  • I've cleared the bin/Debug and the C:\Users\userName\AppData\Local\Temp folders.
  • I've reseted the VS Experimental Hive enviroment.
Nothing has worked out so far.

What do I have to do to get the Extended WPF Toolkit to work in a Visual Studio 2013 Package?

Thanks
Developer
Aug 6, 2015 at 11:56 AM
Hi,

Have you tried a simple CheckComboBox ? something like :
<xctk:CheckComboBox />
What version of the Toolkit are you using ?

Have you tried a new project without VS Experimental Hive ?

Have you tried in another version of VS, like VS2012 ?

Does the application loads and only the XAML Designer shows the error ?
Aug 6, 2015 at 5:53 PM
Hi,

I've tried a simple CheckComboBox and it fails as well.

According to NuGet, the Extended WPF Toolkit version is 2.5.

I created a new WPF application, got Toolkit through Nuet, added the single line CheckComboBox you proposed and it works just fine.

I have not tried any other VS version.

Yes, the Package loads and the rest of the extension works just fine. But as soon as this user control is shown, an exception appears on the XAML designer.
Developer
Aug 7, 2015 at 2:07 PM
Hi,

I'm not sure I understand the problem.
You say : "...a simple CheckComboBox and it fails as well. "
Then : "....added the single line CheckComboBox you proposed and it works just fine. "
And then : "...the Package loads and the rest of the extension works just fine".
But there is an exception in the XAML designer.

I don't have any exception in the XAML designer for a single line CheckComboBox.

Can you provide a sample ?
Aug 7, 2015 at 3:01 PM
Hi,

Let me clarify the situation:

My VSPackage consists of various ToolWindows.
I want to add a CheckComboBox to only one of them, lets call it TW1.
When I debug my VSPackage, everything works fine until you open TW1.
When you open TW1, then the XamlParseException occurs and the XAML editor is shown, so you can see that your control cannot be instantiated.
Even using only the xaml "<xctk:CheckComboBox />" will throw the exception whenever TW1 is opened.

The Sample:
I have created a brand new VSPackage, added Extended WPF Toolkit through NuGet and added the xaml "<xctk:CheckComboBox />" and it throws the exception as well.

You can download it from here: VS2013PackageWithCheckComboBox.rar.
Developer
Aug 7, 2015 at 7:54 PM
Hi,

I think the problem doesn't come from the Toolkit, but from your package that can't find the Xceed.Wpf.Toolkit.dll. When the new Visual Studio is started, it has to reference the Toolkit in order to have access to its controls. We are not working with VS Packages.
This may be a start :
http://stackoverflow.com/questions/13674782/vsix-cannot-load-file-or-assembly-of-a-referenced-dll
http://stackoverflow.com/questions/20001191/vsix-extension-uses-3rd-party-dlls-unable-to-load-one-of-the-dependency
Marked as answer by JoanComasFdz on 8/8/2015 at 4:04 AM
Aug 8, 2015 at 11:04 AM
Hi,

You were right, the problem was how Visual Studio loads assemblies from an extension.

I used the [ProvideBindingPath] from the first stack overflow link and it worked :)

Thanks for the support.