C# .Net Core 3.1 System.Text.Json Ignore empty collection in serialization
Using Newtonsoft we had a custom resolver for ignoring empty collections. Is there any equivalent configuration for the new system.text.json in .Net core 3.1
- Modified
- 13 Jan at 16:37
Operation is not valid due to the current state of the object (System.Text.Json)
We've got an API, which simply posts incoming JSON documents to a message bus, having assigned a GUID to each. We're upgrading from .Net Core 2.2 to 3.1 and were aiming to replace NewtonSoft with the...
- Modified
- 14 Jan at 09:40
.Net Core 3.1 Process.Start("www.website.com") not working in WPF
I am using .Net Core 3.1 Framework in WPF Application. I have a button event in which I am trying to redirect to Instagram url on click. but its giving me the following error. >Exception thrown: 'Syst...
Resharper turn off types hints
How to turn off types hints in `Visual Studio 2019` `C#` code editor? [](https://i.stack.imgur.com/6RP9B.png)
- Modified
- 13 Jan at 12:6
Type 'null' is not assignable to type 'T'
I have this generic method ``` class Foo { public static bar<T>(x: T): T { ... if(x === null) return null; //<------- syntax error ... } } ... //...
- Modified
- 13 Jan at 11:0
Why asp.net core sending empty object as response?
When I debug the code in VS, the cities list, which I am returning have 3 objects in it along with the properties. When I call this endpoint I am receiving a response of 3 list items of empty objects....
- Modified
- 15 Jan at 07:48
Adding custom middleware not working when using IMiddleware
I am trying to add a custom middleware to the pipeline (to be easier I will pick the .NET Core documentation example). Let's say we want to have the Spanish culture set whenever a call to API is fired...
- Modified
- 13 Jan at 09:38
Jetpack Compose - Column - Gravity center
I'm creating a layout with Jetpack Compose and there is a column. I would like center items inside this column: ``` Column(modifier = ExpandedWidth) { Text(text = item.title) Text(tex...
- Modified
- 21 Dec at 09:40
Return IAsyncEnumerable from an async method
Take the following the methods: ``` public async IAsyncEnumerable<int> Foo() { await SomeAsyncMethod(); return Bar(); // Throws since you can not return values from iterators } public async IA...
- Modified
- 10 Jan at 21:55
Why does the C# compiler allow a duplicated variable in nested scope?
Historically, when developing in .Net I duplicate the name of variable in nested scope. However, after recently updating Visual Studio 2019 to version 16.4.2 I have noticed that variable names can be...
- Modified
- 10 Jan at 20:24
ServiceStack /types/csharp generating invalid attribute signatures in v5.7
In our upgrade to ServiceStack v5.7, the file generated by the NativeTypesService at `/types/csharp` is now producing invalid code. We are using ASP.Net (NOT Core), .Net Framework 4.7.2. Specifica...
- Modified
- 10 Jan at 20:7
Unable to cast object of type ServiceCollection to type 'Autofac.ContainerBuilder' using dotnet core and autofac
I am trying to use `autofac` in my `dotnet core 3.1` project, but I am unable to run project after writing `ConfigureContainer` inside the `startup.cs` file. ``` public void ConfigureContainer(Contai...
Disable AutoDetectChanges on Entity Framework Core
someone knows how to disable the AutoDetectChanges on EFCore? I need to do it because I have to make an huge import in my database, and can't find information on web. Tried this but it's not working...
- Modified
- 9 Jan at 16:24
Servicestack automap update endpoints
We are using ServiceStack QueryDb to expose certain business objects for auto-querying, and it is working great. ``` [Route("/catalog/customers")] [Authenticate] public class QueryCustomers...
- Modified
- 9 Jan at 14:32
Console.ReadLine() not working in VS Code, writing a code in C#
I am learning C# and I am using VS Code, when I tried to take input from user using Console.ReadLine() it's not working. I referred from a video which did exactly same thing and still after a couple ...
- Modified
- 9 Jan at 14:1
Are EF Core 3.1 ExecuteSqlRaw / ExecuteSqlRawAsync drop-in replacements for ExecuteSqlCommand / ExecuteSqlCommandAsync?
Upon upgrade to EFCore 3.1 deprecated warnings appeared: > Warning CS0618 'RelationalDatabaseFacadeExtensions.ExecuteSqlCommandAsync(DatabaseFacade, RawSqlString, params object[])' is obsolete: '...
- Modified
- 9 Jan at 16:13
Get instance of class that relies on DI in Startup class
I am running .NET Core 2.2 app and I have a bit of code that I want to run immediately after the initial setup in Startup.cs. The class relies on a registered type and I don't really understand how I ...
- Modified
- 26 Jul at 07:32
How to Localize validation message (DataAnnotationsValidator) in blazor server side
I am using blazor 3.1 in latest version of VS 2019. So far, I am able to localize page labels (title, table fields etc.). On the `ListEmployee.razor` page, I am able to localize table heading etc. O...
- Modified
- 10 Jun at 05:50
Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'
I am using asp.net core 3.1 docker enabled project template (VS2019) to develop a web API. There are no compilation errors. While running the project, in the output window of the VS2019 I see the fo...
- Modified
- 9 Jan at 05:1
.NET Core - HttpClient vs RestSharp
I've been scouring the internet all day for a simple comparison, but have yet to find any up to date information regarding the subject. I recently joined a team working on a project that is using Rest...
- Modified
- 26 Sep at 02:6
Using Entity Framework Core 3.1 with UseInMemoryDatabase option in ServiceProvider ( Scoped lifetime )
I have migrated a web application project from .NET Core 2.1 to 3.1 (also EF Core from 2.1.1 to 3.1.0). After the migration, some unit tests are not working anymore, throwing duplicate keys db except...
- Modified
- 8 Jan at 18:5
How to get and inject the IHostApplicationLifetime in my service to the container (Console App)
Following this [answer](https://stackoverflow.com/a/55960329/375460), I want to inject the `IHostApplicationLifetime` in my class to shutdown properly when the method `StartAsync` is over. But I don'...
- Modified
- 8 Jan at 16:37
Android Studio (not installed) , when run flutter doctor while Android Studio installed on machine
When I run flutter doctor command on mac its showing below, while I already install Android Studio, and I can run ios build from Android Studio. flutter doctor output: ``` Doctor summary (to see a...
- Modified
- 6 Sep at 13:12
Deserialize json one record at a time
I am working with large json files and memory is a concern. I would like to read one object into memory at a time from file. Is this possible? In ServiceStack.Text docs it says there is an API usin...
- Modified
- 8 Jan at 14:14
Using Autofac with ASP.Net Core 3.1 generic host "Worker Service" application
In an ASP.Net Core application, its easy to configure Autofac using: But in a generic host, the **Worker class** does not have any built in support for `ConfigureServices` and `ConfigureContainer`. Ho...
- Modified
- 5 May at 15:47