OutOfCharacters
OutOfCharacters

Reputation: 131

Exception Thrown Due to Package Problems With Watson

I want to make a C# application in Visual Studio 2015 that utilizes IBM's Watson Assistant SDK, which has information on it that can be found here. However, when I go to run my code and initialize an instance of AssistantService, it throws this System.Security.VerificationException, with a popup window highlighting the constructor being called that says

An exception of type 'System.Security.VerificationException' occurred in System.Net.Http.Formatting.dll but was not handled in user code Additional information: Method System.Net.Http.CloneableExtensions.Clone: type argument 'System.Net.Http.Headers.MediaTypeHeaderValue' violates the constraint of type parameter 'T'.

I have done some research, and obviously know the problem has to do with the System.Net.Http package which I reverted to version 4.0.0 based off of a recommendation in a previous thread, to no avail. I can provide more information about my setup, my code, and the error if it would be helpful. Thanks in advance for any advice someone is able to provide.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using IBM.WatsonDeveloperCloud.Assistant.v1;

namespace Watson_Test
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        AssistantService _assistant;

        public MainWindow()
        {
            InitializeComponent(); 
            _assistant = new AssistantService();
            Console.WriteLine("Success!");                 
        }
    }
}

Here is a link to the entirety of my program's output.

Upvotes: 0

Views: 368

Answers (1)

OutOfCharacters
OutOfCharacters

Reputation: 131

I wanted to report back on this. I was able to solve my problem by updating all my packages to the current version, since it wasn't letting me update System.Net.Http due to some dependency conflict. After that, I reverted System.IO.Compression to version 4.1.0, which reverted NETStandard.Library to version 1.6.0, again due to dependency.

Everything is working fine now, hopefully this helps someone else working on this sort of thing.

Upvotes: 1

Related Questions