-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot instantiate ServiceContext in .NET Core #50
Comments
This is a dll hell issue- old version of dll being referenced or multiple versions of same dll causing issues. Please delete all references of the prob dll. Then clean code and do a build again after adding the dll back. |
But this was added via Nuget |
Yes, even if our dotnet SDK dll was added via Nuget, it can conflict with some local ref in your code. |
Create a new sample proj to add Nuget package for dotnet SDK, do you still get the error? If not, then dll hell issue is confirmed. |
Was this fixed by steps suggested above? |
I just got this same error, which led me here. I installed System.Configuration.ConfigurationManager from NuGet (and I also had to install DevDefined.OAuth), but this fixed it. It would sure be nice to have a .Net Core library. |
Thanks for the feedback. We are working on adding support for .Net Standard in future. |
We are working on releasing the beta version of our DLLS for .net standard which you can use with .Net Core 2.1 projects. Thanks, |
Please reply with your email ids, in case you are interested. I can send the zipped SDK dlls and steps to download any additional dependencies from Nuget. Later, in a few weeks when we release it, we will be releasing the NUget package with required dependencies. |
I am also experiencing a similar issue with my .NET Core 2.2 app, but I am unable to discern a solution from this issue thread:
I am using the preview nuget package mentioned in another thread; https://www.nuget.org/packages/IppDotNetSdkForQuickBooksApiV3_NetStandard2_0/7.5.1-beta Here is my code which is failing to initialize the ServiceContext object:
The above code was adapted from the QBO SDK developer documentation: https://developer.intuit.com/app/developer/qbo/docs/develop/sdks-and-samples-collections/net#connect-to-quickbooks-online |
Can you enable fiddler logs to run along with your local code?The beta package we had released had some caching issues with 4.7.2 dlls. We are generating another nuget release soon and will update you. Wait for that. Steps to use fiddler- Download Fiddler from Google and run it alongside your code to log raw requests and responses along with URL and headers. When you download Fiddler, open it, go to Tools > Fiddler Option > Enable (Tick Mark) Capture HTTPS connects > Enable Decrypt Https traffic. That’s it. No other setting is required. The .NET localhost is by default captured in Fiddler, so after you have enabled https traffic in Fiddler just run your code. (Fiddler should be open.) You will see requests and responses logged in Fiddler. You should set 'decode the raw request body' by clicking on the yellow bar in Fiddler. Then go to the File menu on top, select Save all session > Save the fiddler session. A .saz file is created, which can be viewed later. |
Hi @nimisha84! Using Fiddler showed no requests being sent as a result of instantiating a ServiceContext object before my code crashed. The error appears to be in the LocalConfigReader.ReadConfiguration() code where it's looks to be attempting to convert a string to an Int32, as per my stack trace above. |
Ok, let me validate this again then. Thanks |
I was able to figure out the cause of this problem! I had simply copied the example appsettings.json content that you had posted in another issue here, referencing .NET Core, and I didn't put in any values for the
|
Retry settings should not be mandatory. Did you set one of them to true and not pass any values or did you have enable= false for everything and still got the error? |
It looks like you set it to true and not set any other values. Fixed the issue. Please test with this package going forward- |
That is correct, I had copied the example config you had posted here (#3 (comment)) without noticing that the exponential retry was enabled. Everything is working now, thanks for your update! |
Thanks. Corrected the example too. |
OAuth2RequestValidator oauthValidator = new OAuth2RequestValidator(systemSettings.AccessToken);
ServiceContext serviceContext = new ServiceContext(systemSettings.RealmId, IntuitServicesType.QBO, oauthValidator);
thows:
Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
StackTrace:
at Intuit.Ipp.Core.Configuration.LocalConfigReader.ReadConfiguration()
at Intuit.Ipp.Core.ServiceContext..ctor()
at Intuit.Ipp.Core.ServiceContext..ctor(String realmId, IntuitServicesType serviceType, IRequestValidator requestValidator)
at PiMarketing.Controllers.CampaignsController.d__17.MoveNext() in C:\Dev2\Pi_Marketing\PiMarketing\PiMarketing\Controllers\CampaignsController.cs:line 576
Its looking for the old ConfigurationManager that doesn't exist in .NET core
The text was updated successfully, but these errors were encountered: