Cannot create and populate list type System.Data.SqlClient.SqlErrorCollection. Path '$values' - json.net

We have been having troubles with deserializing sql exceptions using newtonsoft.net
Version 11.0.2
On .Net 4.6.2 (Full)
We didn't have these issues before when we where on an earlier version of newtonsoft. (10.x)
Reproduction case in Gist
I have been searching around for how to fix this. But all i can find are solutions in which you decorate the offending property with an attribute. Which obviously is not a option here.
Upgrading our .Net version is an option, but is non trivial for us. So im trying to find out if i have other options. Im not even sure that upgrading the .net version is going to fix this.
Update: I have been looking into using a custom ContractResolver to try and restore the old behavior, as suggested in the comments, however this does not work.
Upgrading to newtonsoft 12.0.3 also does not help.
Upgrading to Net48 also does not help.

Related

Why won't this .NET project compile?

I'm building a project as part of a course, I didn't build it from scratch but I've got it at a stable level that compiles perfectly with no errors or warnings.
I need to add Entity Framework Core. The video shows the instructor installing 2.1.4 even though the latest is 3.1.4. What the heck, I install the older version. Everything's still peachy.
But I don't want 2.1.4, I want 3.1.4. I won't go into the reasons, but suffice to say that version supports EDMX. Please don't question me on that. Incidentally I have 3 projects in the solution and only one of them had the EF Core installed. Does that matter? Anyway, after installing 3.1.4 in that one project I get this.
Error NU1107 Version conflict detected for Microsoft.EntityFrameworkCore. Install/reference Microsoft.EntityFrameworkCore 3.1.4 directly to project OdeToFood to resolve this issue.
OdeToFood -> OdeToFood.Data -> Microsoft.EntityFrameworkCore (>= 3.1.4)
OdeToFood -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.EntityFrameworkCore (>= 2.1.1 && < 2.2.0). OdeToFood D:\Visual Studio Projects\OdeToFood\OdeToFood\OdeToFood.csproj 1
OdeToFOod is the project, OdeToFood.Data is the one of three projects I added EF Core to.
Dear Microsoft, is it asking too much for you to give your error messages in something resembling English? I'm at my wits end with this stupid project. The error message SEEMS to be saying to install 3.1.4 directly to that project. Isn't that what I just did?! Perhaps they mean right-click the project and say manage Nuget for that project instead of "Manage Packages for Solution"? Doesn't make sense to me, but I'll try it. So when I do that it (obviously) already shows 3.1.4 as installed, so that can't be it. So why don't we start nice and fresh, huh? Let's uninstall 3.1.4 from that project and re-install.
Nope. Same error message except this time it mentions a different project, one that never had EF Core installed in the first place. Okay fine Microsoft, I'll play your game. So even though I have no use for it in this second project, I'll install it anyway. Let's see what happens shall we?
OMG.... DISASTER!!!! It's now worse! I still have that error message, but now I have a "package out of dependency constraint" (English please??) and it references ANOTHER package that now has a version conflict, one that hasn't even been touched. What the hell is going on here? I'll bet at this point I can't even go back to Core 2.1.4 anymore. There's got to be some config file or .csproj or something that I can edit because this is unbelievable. I'm trying to follow the directions as best as I can understand them (which isn't much) and it keeps getting worse. And not only that but it appears that EF Core never DID install on this other project anyway so I think there's no fixing this problem at this point, I'm going to have to restore from backup and start over. Why does Microsoft have to make everything so freaking complicated?! Can they at least make this a little more forgiving and user friendly so it doesn't take a PhD to figure out these errors?
I'm just a beginner at this but how am I supposed to learn this if I can't even get a simple thing like this to compile? I try to follow the directions as best I can and that only makes things worse. I'm ready to declare this project FUBAR, throw my computer through a window, buy a sheep farm and never code again!
We love Scott Allen and his tutorials :)
Seems like scoot have updated entity framework with latest version. Link below
GitHub Repository
If you want to update by yourself i suggest to remove ef Core 2.1 packages from odeToFood & OdeToFood.Data project and install ef core 3.1 in both project accordingly. Hopefully this will resolve the issue. Happy learning.

Dotnet Core 3.1, EF1001: internal ef core api usage

Upgraded to Dotnet Core 3.1 from 2.2, EF core kept complaining EF1001: internal ef core api usage by putting an Exclamation Mark in my project.
But no error / warning shown during compilation. I do not know which line of code is causing the trouble.
May I know how can I find out which API / Method that I am not suppose to use?
The warnings from these analyzers can be really confusing. If I understand this correctly, the issue is not what it seems.
The message with the gray warning icon inside the analyzer is normal and indicates what the analyzer is checking. See the Analyzers in Solution Explorer documentation for an explanation.
If you are experiencing yellow icons on the parent node ("Analyzers") try to unload/reload the project, or maybe open Visual Studio in admin mode. See the answer to "Analyzers warnings in ASP.NET Core 2.2 project in VS2019
" for details.
If you don't see a warning in the error list then I advise you to ignore that.
The GitHub issue "Confusing analyzer warnings in solution explorer with no way to see any details" provides additional information on this.
Are you using a database provider (i.e. packages for SQLServer, Postgres, etc)?
It sounds like you are saying there is some warning being given with your dependencies. I know Microsoft announced some breaking changes, mainly for database providers, with EF Core with the 3.0+ updates. Could be as simple as updating the other packages in your project.
Just guessing, I could very well be wrong.
figure it out for me, was getting the same warning,
it was using an entity framework namespace
(using Microsoft.EntityFrameworkCore.Internal;) and not
using System.Linq; which was extremely odd as I didn't add the Ef one at all.
which is why I was so confused and started googling and how i got to this page.

Having a little issue with Flurl (are you missing a cast?)

Hello Stackoverflow Users,
I just want to use an API of someone, but he did'nt put a release on github so you have to compile the api for yourself.
The API im trying to use, is using Flurl, i imported everything but now i have some errors and i can't compile the api.
(Note: im asking here for help because im not that advanced enough to know how i can fix this)
The error is saying:
Cannot implicitly convert type 'Flurl.Http.IFlurlClient' to 'Flurl.Http.FlurlClient' An explicit conversion exists (are you missing a cast?)
A Screenshot of the Error in Visual Studio
(The API Iam trying to use is https://github.com/Tustin/psn-csharp)
The IFlurlClient interface was introduced in Flurl.Http 1.1, but the source code you're working with uses 1.0.1. If you downgrade to Flurl.Http 1.0.1 you should be fine. It might be easiest to just start over, i.e. re-download the API source and don't upgrade the NuGet packages.

How can I upgrade my Realm Swift version from 0.96 to 0.97?

Can I just replace the two old version realm frameworks to the new version ones? Or what should I do?
Yep! If you're not using a dependency manager like CocoaPods or Carthage, you just need to delete the old framework folders and copy the new ones into the same place. Xcode should be fine handling that the next time you attempt to build your project.
If you are using a dependency manager, then you just need to hit the update command in their command line tools, and it'll be taken care of automatically.
Please keep in mind that Realm 0.97 has completely removed all of its previously deprecated APIs, so if you were using any of those, you will get build errors, but they'll be very easy to fix.
I cam up with the same question and while looking around came up with a good solution. This is in addition to what TiM has pointed out. Also, a few things to keep in mind:
I upgraded from version 1.0 to 1.0.1: so there weren't many changes to the framework and commands I used in my app.
I didn't use any special or very specific commands. Mainly the queries and writes/updates of objects. Nothing very fancy. If you have very specific requirements of Realm than I suggest look into those and see if there are any special changes to how they are managed.
Now to the steps:
Remove the frameworks from the "Embedded Binaries" section by clicking the "-":
General Tab - Embedded Binaries
Remove the frameworks from the project itself by right-clicking on them and select "Delete"
Navigator - Framework Files
Now just go and do the steps for installing the frameworks as found in the documentation "realm.io/docs/swift/latest/#installation-swift-22".
I understand this question is rather old, but looking through the SO I dint find a definite answer to this.
Hope this helped!

Visual Studio 2012 ASP.NET bundling fails part way through

I'm trying to setup VS 2012's new bundling functionality (via the Microsoft.Web.Optimization package - read more here) and for the most part, everything is working alright. The problem is that the processing just gives up after ~15000 characters.
When I build and run the page, I get a bunch of failures because the JavaScript files that have been loaded are truncated halfway through a line in the middle of a function...
Has anyone else experienced this or does anyone have any insight into how resolve this issue?
--UPDATE--
I originally encountered this error using foo.AddDirectory("~/scripts/", "*.js"). Using foo.AddFile("~/scripts/bar.js") only results in the javascript errors when I include any jquery plugins. No errors are being thrown on the server.
--UPDATE2--
The problem was a result of the Web Optimization library not being up to date. I highly suggest that anyone attempting to use this retrieve the library via NuGet command line: Install-Package -IncludePrerelease Microsoft.AspNet.Web.Optimization. There are various versions of documentation and examples on the web, but the most current can be found using the above method and the most current documentation is that found in the answer below.
Do you have a small repro? My guess is that maybe there's an issue with the javascript files that are in the bundle.
Its also possible the minifier is choking on something and/or incorrectly minifying them.
If you are using the Scripts.Render helper, have you tried running with debug = true to make sure that everything works correctly with no bundling or minification?
Here's also the latest documentation which might be helpful: http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification

Resources