본문 바로가기

Programming/.NET24

[.NET] Rx.NET Error Handling https://introtorx.com/chapters/error-handling-operators Error Handling Operators | Introduction to Rx.NET Error Handling Operators Exceptions happen. Some exceptions are inherently avoidable, occurring only because of bugs in our code. For example, if we put the CLR into a situation where it has to raise introtorx.com 2024. 2. 23.
[.NET] Unit testing best practice 테스트 케이스 작성할 때 항상 참고하는 글 https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices?source=docs Best practices for writing unit tests - .NET Learn best practices for writing unit tests that drive code quality and resilience for .NET Core and .NET Standard projects. learn.microsoft.com 2024. 1. 11.
[Azure] GitHub actions 배포 시 ValidateAzureResource Exception GitHub Actions를 통해 CI/CD를 구축하다 보면 한 번에 성공한 적이 단 한 번도 없다. 오늘도 역시나 전송 실패 메일😭😭 아래 로그가 남아 있었다. Error: Execution Exception (state: ValidateAzureResource) (step: Invocation) Error: When request Azure resource at ValidateAzureResource, Get Function App Settings : Failed to acquire app settings (SCM) Error: Failed to fetch Kudu App Settings. Bad Request (CODE: 400) 1. Azure Portal에서 Networking 탭에서 다음 문구.. 2024. 1. 5.
[Azure Functions] Timer Trigger Time Zone 설정하기 appsettings.json에서 설정이 가능하다. 운영체제 별로 설정값이 다르다. 배포되어 있다면 Azure Portal > FunctionApp > {your function app} > Configuration에서 설정이 가능하다. 다만, 주의할 점이 있다! 나처럼 리눅스 Consumption plan을 사용하고 있는 사람은 Time zone 설정이 불가능하다(테스트해봄). 덕분에 Azure Functions App을 Window OS로 하나 더 만드느라 너무 귀찮았다.😢 https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#website_time_zone App settings reference for Azur.. 2024. 1. 4.
[Azure Functions] local에서 TimeTrigger Exception TimeTrigger를 개발하고 있는데 로컬에서 아무 설정 없이 디버깅하면 아래 Exception이 발생한다. The listener for function 'Functions.GenerateTweet' was unable to start. Microsoft.Azure.WebJobs.Extensions.Timers.Storage: Could not create BlobContainerClient for ScheduleMonitor. local.settings.json 파일에서 아래와 같이 설정하면 정상 동작이 가능하다. "AzureWebJobsStorage": "UseDevelopmentStorage=true", Azure Functions은 Azure Storage와 상호 작용하는데 로컬에서 Azuri.. 2024. 1. 1.
[Azure Functions] .NET 8 프로젝트 생성하기 Azure Functions 프로젝트를 생생하려니 .NET 6만 보여서 당황했다. VS 2022 아래 Options에서 [Check for updates] 버튼 클릭 후 [Download & Install] 버튼을 클릭하면 .NET 8을 선택할 수 있도록 다운로드 받을 수 있다. https://github.com/Azure/azure-functions-dotnet-worker/issues/1644#issuecomment-1711948162 .NET 8.0 support · Issue #1644 · Azure/azure-functions-dotnet-worker .NET 8 support tracking items. #1653 Project template updates Azure/azure-functio.. 2023. 12. 31.
[.NET] ML.NET 고양이 vs 개 분류(Image Classification) 거의 모든 것을 할 수 있는 .NET 으로 머신러닝을 찍먹해본다. 아래는 10분 튜토리얼이다. https://dotnet.microsoft.com/en-us/learn/ml-dotnet/get-started-tutorial/intro ML.NET Tutorial | Get started in 10 minutes | .NET Step-by-step instructions for building a simple prediction model with ML.NET on Windows, Linux, or macOS. ML.NET is a machine learning framework for .NET. dotnet.microsoft.com 근데 설치만으로 10분 넘게 걸린듯 하다. 나는 튜토리얼과 다르게 개 v.. 2023. 2. 5.
[.NET] BenchmarkDotNet로 .NET 6 vs .NET 4.7.2 성능 비교 BenchmarkDotNet 를 이용해서 .NET 6와 .NET 4.7.2 성능을 비교하는 방법 1. csproj 파일에 아래 코드를 추가한다. net6.0;net472 AnyCPU 2. Benchmark할 method나 class에 아래 Attribute를 추가한다. 나는 .NET 4.7.2 vs .NET 6를 비교할 예정이라 2개를 추가했다. 3. Release 모드 바꾸고 Run without Debugging 을 클릭한다. 아무 시나리오 없이 그냥 튜토리얼에 주어지는 소스코드를 사용했다. https://github.com/HanJaeJoon/DotNetBenchmark-net472-net6 GitHub - HanJaeJoon/DotNetBenchmark-net472-net6 Contribute t.. 2023. 1. 15.
[.NET Core] Custom Middleware의 Scoped lifetime 서비스 주입 Custom Middleware에서 Scoped lifetime의 서비스를 주입받는 경우에는 Constructor가 아니라 InvokeAsync 메서드에서 주입받아야 한다. public class MyCustomMiddleware { private readonly RequestDelegate _next; public MyCustomMiddleware(RequestDelegate next) { _next = next; } // IMessageWriter is injected into InvokeAsync public async Task InvokeAsync(HttpContext httpContext, IMessageWriter svc) { svc.Write(DateTime.Now.Ticks.ToString.. 2023. 1. 3.