New C# API reference is not working. System.Buffers version mismatch in Nuget

varuns
On top of new C# reference, System.Text.JSon, System.Memory and System.Buffers like this several additional binaries are required. Also As I look through the System.Buffers latest version in Nuget packages is 4.0.0.0. But Kite Connect is looking for System.Buffers file of version 4.0.2.0. So latest API is not working.
kindly do the needful
  • tonystark
    I believe this collision is due to a library that is already present in your project. A fresh project works fine to me. Could you check your other dependencies?

    I tried a fresh project like this:
    $ dotnet new console -name kctest -o kctest
    $ cd kctest
    $ dotnet add package Tech.Zerodha.KiteConnect
    $ dotnet run
    Login with: https://kite.trade/connect/login?api_key=asdasdsd&v=3
    Program.cs:
    using System;
    using KiteConnect;

    namespace kctest
    {
    class Program
    {
    static void Main(string[] args)
    {
    Kite kite = new Kite("asdasdsd", Debug: true);
    Console.WriteLine("Login with: " + kite.GetLoginURL());
    }
    }
    }
  • varuns
    But the existing project is nothing but same application which is running already with Kite 3.0.0.0. Now all I am doing is replacing it to 3.0.3.0. So, is automatic migration is not supported? Am still not comfortable to recreate my project as my application as I dont want duplicates. here are the list of Libraries I am using in my project. could you help me find out.
    AWSSDK.core, KiteConnect, MSCsharp, netstandard, System, System.configuration, System.Core, System.Data, System.Data.DataSetExtensions, System.Net.Http, System.XML and
    additionally below are Selenium references too which I am using.
    Castle.Core, Newtonsoft.Json, WebDriver, WebDriver.Support.

    Please do the needful.
  • tonystark
    Fixing project level dependencies is difficult, out of scope of this forum and it is upto developer to resolve. I can give you some pointers to help you in the decision making:

    - 3.0.0 is a very old version. Current version is 3.0.7 targeting netstandard20. Highly recommended to keep the libraries upto date.
    - Before 3.0.5 library doesn't need any external dependencies from Nuget. Check here.
    - The dependencies changed only in 3.0.5 as part of migration to netstandard20.
    These are the dependencies in this version (check here):
    CsvTextFieldParser (>= 1.2.1)
    Microsoft.CSharp (>= 4.7.0)
    System.Text.Json (>= 4.7.1)
    So if any issue happens while upgrading to 3.0.3 is due to the changes in minor versions of project dependencies.
    - From your original post, System.Buffers latest version is actually 4.5.1 not 4.0.0.
    - If you are upgrading a package and a conflict happens then you have to manually upgrade other libs that causes the conflict. A package manager like Nuget will not automatically do a major version upgrade in case of a conflict because a major version means a breaking change is happening that can potentially break the code.
  • varuns
    Hi Tony,

    As advised, today I tried creating a new VS 2019 C# Console Application Project.
    And I have given the below command to install Kite connect nuget package. But please see the error message. What could be the issue?

    PM> Install-Package Tech.Zerodha.KiteConnect
    Install-Package : Unable to find package 'Tech.Zerodha.KiteConnect'
    At line:1 char:1
    + Install-Package Tech.Zerodha.KiteConnect
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

    varun
  • varuns
    Note : I am creating the project in 4.7.2 framework
  • varuns
    yes I tried it. But still getting similar error message. Below find the cmd and response.

    PM> Install-Package Tech.Zerodha.KiteConnect -Version 3.0.7


    Attempting to gather dependency information for package 'Tech.Zerodha.KiteConnect.3.0.7' with respect to project 'TradingService', targeting '.NETFramework,Version=v4.7.2'
    Install-Package : Package 'Tech.Zerodha.KiteConnect 3.0.7' is not found in the following primary source(s): 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
    Please verify all your online package sources are available (OR) package id, version are specified correctly.
    At line:1 char:1
    + Install-Package Tech.Zerodha.KiteConnect -Version 3.0.7
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
  • tonystark
    @varuns This seems like a setup/environment issue and is outside the scope of KiteConnect.
  • varuns
    if Anyone having same issue like me.,
    the issue is due to the nuget package source configuration is not set properly.

    In your Project Solution, Nuget Package manager, set the Nuget package source by selecting settings button.
    add/edit the existing package source location as below..
    "http://api.nuget.org/v3/index.json"

    it was earlier set as "http://www.nuget.org/v3/index.json" in my project and hence i could not simply download any nuget package.

    Thanks @tonystark .
This discussion has been closed.