.net-core

.NET Core: Finally block not called on unhandled exception on Linux

99封情书 提交于 2020-12-25 07:07:37
问题 I have created the following C# program: namespace dispose_test { class Program { static void Main(string[] args) { using (var disp = new MyDisposable()) { throw new Exception("Boom"); } } } public class MyDisposable : IDisposable { public void Dispose() { Console.WriteLine("Disposed"); } } } When I run this using dotnet run , I see the following behavior: Windows: Exception text written to console, "Disposed" printed ~20 second later, program exits. Linux: Exception text written to console,

.NET Core: Finally block not called on unhandled exception on Linux

半世苍凉 提交于 2020-12-25 07:07:05
问题 I have created the following C# program: namespace dispose_test { class Program { static void Main(string[] args) { using (var disp = new MyDisposable()) { throw new Exception("Boom"); } } } public class MyDisposable : IDisposable { public void Dispose() { Console.WriteLine("Disposed"); } } } When I run this using dotnet run , I see the following behavior: Windows: Exception text written to console, "Disposed" printed ~20 second later, program exits. Linux: Exception text written to console,

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

人走茶凉 提交于 2020-12-24 07:12:08
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

南笙酒味 提交于 2020-12-24 07:11:17
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

余生长醉 提交于 2020-12-24 07:06:45
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

Trying to add AutoMapper to .NetCore1.1 - not recognising services.AddAutoMapper()

…衆ロ難τιáo~ 提交于 2020-12-24 07:06:39
问题 I've installed the following Nuget packages into my project: Automapper AutoMapper.Extensions.Microsoft.DependencyInjection I have added the line to ConfigureServices in Startup.cs . public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // . . . services.AddAutoMapper(); } I'm still getting a red line under services.AddAutoMapper() . It says: The Call is ambiguous between the following methods or properties: ServiceCollectionExtensions

How to validate signature of JWT from jwks without x5c

丶灬走出姿态 提交于 2020-12-19 04:23:28
问题 I have a JWT security token which I need to verify via jwks endpoint. Data in jwks looks like: { "keys": [ { "kty": "RSA", "e": "AQAB", "use": "sig", "alg": "RS256", "n": "......", "kid": "2132132-b1e6-47e7-a30f-1831942f74bd" }, { "kty": "RSA", "e": "AQAB", "use": "sig", "alg": "RS256", "n": "......", "kid": "tsp-app-a" }, { "kty": "RSA", "e": "AQAB", "use": "sig", "alg": "RS256", "n": ".....", "kid": "tsp-app-b" } ] } I have tried one third party api but it looks like it is dependent on x5c

dotnet core 3.1 windows service fails to load configuration settings

给你一囗甜甜゛ 提交于 2020-12-16 03:42:20
问题 I've run into a problem with a dotnet core 3.1 application that's designed to run as a windows service. The project originates from the Worker Service template in VS2019. Below is the call stack logged into the system event log. I can't find anything on SO or via web search. If I execute the application directly (double-click) or from a command line it runs fine. The exception is only thrown when executed as a windows service. Description: The process was terminated due to an unhandled

dotnet core 3.1 windows service fails to load configuration settings

风流意气都作罢 提交于 2020-12-16 03:41:09
问题 I've run into a problem with a dotnet core 3.1 application that's designed to run as a windows service. The project originates from the Worker Service template in VS2019. Below is the call stack logged into the system event log. I can't find anything on SO or via web search. If I execute the application directly (double-click) or from a command line it runs fine. The exception is only thrown when executed as a windows service. Description: The process was terminated due to an unhandled

Entity Framework: Get the DataType of Metadata IProperty

喜欢而已 提交于 2020-12-15 06:14:49
问题 How do I find the DataType of Metadata.IProperty in Entity Framework Core? var tableType = _dbContext.Model.GetEntityTypes().First(c => c.GetTableName() == tableName); foreach (var property in tableType.GetProperties()) { var test = property.PropertyInfo.PropertyType.Name; Using property.PropertyInfo.PropertyType.Name , sometimes works, however for nullable objects it prints null. I am looking for a clean way to get data type. 回答1: The Type of the IProperty is represented by ClrType property.