locked
Stripe Newtonsoft version issues - use two different versions ? RRS feed

  • Question

  • User379720387 posted

    Several pieces of functionality in my code use Newtonsoft 11.0.0

    Now working on Stripe implementation and the first time the Stripe API is called I get this exception.

    System.IO.FileLoadException
    Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    File name: 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
       at Stripe.EventUtility.ParseEvent(String json, Boolean throwOnApiVersionMismatch)
       at Stripe.EventUtility.ConstructEvent(String json, String stripeSignatureHeader, String secret, Int64 tolerance, Boolean throwOnApiVersionMismatch) in /_/src/Stripe.net/Services/Events/EventUtility.cs:line 88
       at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
       at ASP._Page_stConfirm_cshtml.Execute() in h:\root\home\bigbird-001\www\Bnew\stConm.cshtml:line 18
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors)
       at System.Web.WebPages.WebPage.ExecutePageHierarchy()
       at System.Web.WebPages.StartPage.RunPage()
       at System.Web.WebPages.StartPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext)
    <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
          </dependentAssembly>

    Someone suggested this little blurb, which I gather means ran two different versions of Newtonsoft at the same time

    <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />

    I have a web.config and packages.config.

    Where does this go and what else do I need to do to have these both functional? Will nuget support this scenario?

    Monday, February 24, 2020 5:34 PM

Answers

  • User475983607 posted

    wavemaster

    I believe stripe.js is dependent on version 9.

    stripe.js is a JavaScript file which runs in the browser.  NewtonSoft is a library that runs on the server.

    wavemaster

    Back to my original question... can I have two versions of Newtonsoft side by side, and if yes, how and where does one put this?

    As far as I understand Stripe uses a REST API but I'm not sure how you are using it.  I'm guessing the version conflict is either a version bug you introduced or maybe you downloaded a 3rd party .NET Stripe API. 

    Anyway, this is somehting you needed to design up front using a strong name.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 24, 2020 7:08 PM

All replies

  • User475983607 posted

    It seems you are targeting two different versions of Newtonsoft.  First settle on the version you want then fix the assembly references to use this version.

    Monday, February 24, 2020 5:43 PM
  • User379720387 posted

    I believe stripe.js is dependent on version 9.

    The rest of my code uses version11

    Don't really want to downgrade from v 11 to 9 because of my existing api functionality with 3rd parties is all difficult to test.

    Back to my original question... can I have two versions of Newtonsoft side by side, and if yes, how and where does one put this?

    Monday, February 24, 2020 6:31 PM
  • User475983607 posted

    wavemaster

    I believe stripe.js is dependent on version 9.

    stripe.js is a JavaScript file which runs in the browser.  NewtonSoft is a library that runs on the server.

    wavemaster

    Back to my original question... can I have two versions of Newtonsoft side by side, and if yes, how and where does one put this?

    As far as I understand Stripe uses a REST API but I'm not sure how you are using it.  I'm guessing the version conflict is either a version bug you introduced or maybe you downloaded a 3rd party .NET Stripe API. 

    Anyway, this is somehting you needed to design up front using a strong name.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 24, 2020 7:08 PM
  • User379720387 posted

    Yup, that it was.

    My WebDeploy no longer works at SmarterAsp.net, lost overview of what had changed and where.

    As far as I understand Stripe uses a REST API but I'm not sure how you are using it.  I'm guessing the version conflict is either a version bug you introduced or maybe you downloaded a 3rd party .NET Stripe API. 

    Monday, February 24, 2020 9:08 PM