.net-5

Is it possible to have a distributed transaction with IBM MQ and SQL Server in .NET5?

不问归期 提交于 2021-01-29 15:47:12
问题 We are thinking of migrating from .NET Framework 4.0 to .NET 5. In our code we often get a message from an IBM MQ Queue and write it to the database in one transaction, or we read and update the database and write to an IBM MQ Queue in one transaction. The code runs on Windows Server 2012, the database is SQL Server 2016 and we have IBM Websphere version 8.0. The distributed transactions are coordinated by MSDTC. Is it possible to do the same with .NET 5? As far as I know, .NET 5 does not

InvalidCastException after upgrading to EF Core 5.0

时光总嘲笑我的痴心妄想 提交于 2021-01-29 07:05:28
问题 I've just upgraded my project from .NET Core 3.1 to .NET 5.0 and updating all packages to the latest version. All built fine, but now I'm having trouble loading some entities, getting this error: Unable to cast object of type 'Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader' to type 'Microsoft.Data.SqlClient.SqlDataReader'.' I'm not certain, but I have a couple of entities which have an Address property which is an [Owned] type which has a NetTopologySuite.Geometries.Point

Fixing the “Duplicate 'Compile' items were included.” error in Visual Studio

a 夏天 提交于 2021-01-29 06:55:15
问题 This is a very annoying VS error, I'm on VS 2019 16.8.1 I spend a lot of time fixing it: Duplicate 'Compile' items were included. The .NET SDK includes 'Compile' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultCompileItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'Program.cs' Service.Host

blazor hosted template project not working after publishing the app

无人久伴 提交于 2021-01-28 21:29:57
问题 I create a new blazor hosted project, named foo, from the dotnet CLI: dotnet new blazorwasm --hosted I run the app with dotnet run -c Release The template app works correctly when requesting https://localhost:5001 (or 5000) I then publish the app with: dotnet publish -c Release And then try to launch it with dotnet Server/bin/Release/net5.0/publish/foo.Server.dll I expect the app to lanch correctly. But I actually get a 404 response. Why is that ? Notes: It was working properly few days ago.

C# 9.0 Support for Top-level programs in Visual Studio 2019

a 夏天 提交于 2021-01-28 19:51:46
问题 With the coming of C# 9.0 and .NET 5 a new feature is getting introduced called "Top-level programs". This functionality takes away a lot of the boilerplate code necessary to create a simple C# application by not having to wrap your code in the usual namespace/class/Main method, as explained in the Welcome to C# 9.0 blog To create a simple "Hello World" application the only required code for a Top-level program is the following (taken from the blog) using System; Console.WriteLine("Hello

How to use default serialization in a custom System.Text.Json JsonConverter?

和自甴很熟 提交于 2021-01-28 11:29:19
问题 I am writing a custom System.Text.Json.JsonConverter to upgrade an old data model to a new version. I have overridden Read() and implemented the necessary postprocessing. However, I don't need to do anything custom at all in the Write() method. How can I automatically generate the default serialization that I would get if I did not have a converter at all? Obviously I could just use different JsonSerializerOptions for deserialization and serialization, however my framework doesn't provide

Deploy as single-file in .net5 with log4net throws exception for config-file

你说的曾经没有我的故事 提交于 2021-01-27 07:22:32
问题 Trying to deploy a console-application written in .Net 5 with log4net as a single-file. Running deployed application throws exception. Steps to reproduce dotnet new console --name TestConsole --language C# (make sure .net 5.0) Install-Package log4net Program.cs static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(new FileInfo("log.config")); var logger = log4net.LogManager.GetLogger("TestLogger"); logger.Info("Hello World!"); } log.config (copy always) <?xml version="1.0

How to connect Grpc (NuGet >2.33) client (.NET Framework) with Grpc.Asp.NetCore (NuGet >2.31) server (.NET 5.0) using HTTPS and my own certificate?

*爱你&永不变心* 提交于 2021-01-16 03:51:44
问题 Exception message: Grpc.Core.RpcException: 'Status(StatusCode="Unavailable", Detail="failed to connect to all addresses", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1606657072.668000000","description":"Failed to pick subchannel","file":"T:\src\github\grpc\workspace_csharp_ext_windows_x86\src\core\ext\filters\client_channel\client_channel.cc","file_line":4166,"referenced_errors":[{"created":"@1606657072.668000000","description":"failed to connect to all addresses

How to use WebMatrix methods with Npgsql in .NET MVC Core 5

感情迁移 提交于 2021-01-07 04:33:59
问题 I want to use WebMatrix.Data namespace #region Assembly WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // .. \packages\Microsoft.AspNet.WebPages.Data.3.2.7\lib\net45\WebMatrix.Data.dll with Npgsql data provider in ASP MVC Core 5. In web.config it is defined as <system.data> <DbProviderFactories> <clear /> <add name="Npgsql Data Provider" invariant="Npgsql" support="FF" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql

How to use WebMatrix methods with Npgsql in .NET MVC Core 5

给你一囗甜甜゛ 提交于 2021-01-07 04:31:13
问题 I want to use WebMatrix.Data namespace #region Assembly WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // .. \packages\Microsoft.AspNet.WebPages.Data.3.2.7\lib\net45\WebMatrix.Data.dll with Npgsql data provider in ASP MVC Core 5. In web.config it is defined as <system.data> <DbProviderFactories> <clear /> <add name="Npgsql Data Provider" invariant="Npgsql" support="FF" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql