Transactionscope throwing exception this platform does not support distributed transactions while opening connection object

.NET Core doesn’t support Distributed Transactions because it would require a different transaction manager on each platform. It may appear in the future (here‘s the issue in-progress), but for now any Transaction that would require two different resource managers will throw this exception. Instead you can coordinate separate transactions. Have two separate transactions complete their … Read more

No service for type ‘Microsoft.AspNetCore.Identity.UserManager`1[Microsoft.AspNetCore.Identity.IdentityUser]’ has been registered

This usually happens in the _LoginPartial.cshtml or _ManageNav.cshtml razor view. Eg. @inject UserManager<IdentityUser> userManager Must be changed to @inject UserManager<MyUserStore> userManager The same applies to SignInManager. When registering your own MyUserStore (bad name, should be MyUser) for the AspNetCore Identity, the UserManager<> type will be registered to the ServiceCollection as UserManager<MyUserStore>. Whenever you want to … Read more

Are you able to use PtrToStringAuto to decrypt a secure string in Powershell 7 on macOS?

Note that [securestring] is not recommended for new code anymore. While on Windows secure strings offer limited protection – by storing the string encrypted in memory – via the DPAPI – and by shortening the window during which the plain-text representation is held in memory, no encryption at all is used on Unix-like platforms.[1] The … Read more

Use HttpClientFactory from .NET 4.6.2

All of the Microsoft.Extensions.* packages target .NET Standard 2.0. That means that you can use Dependency Injection, Configuration, Logging and HttpClientFactory if you add the appropriate package to your application. You need to add Microsoft.Extensions.Http to use HttpClientFactory and Microsoft.Extensions.Http.Polly if you want to use it with Polly To configure HttpClientFactory you’ll have to add … Read more

Reference external DLL in .NET Core project

.Net Core 2 supports a direct reference to external .dll (e.g. Net Standard libraries, classic .Net Framework libraries). You can do it through Visual Studio UI: right click on Dependencies->Add reference->Browse and select your external .dll. Alternatively, you can edit .csproj file: <ItemGroup> <Reference Include=”MyAssembly”> <HintPath>path\to\MyAssembly.dll</HintPath> </Reference> </ItemGroup> You can face with the following error: … Read more

How to use Bootstrap modal in Blazor client app?

There is likely a better way to do this, but here’s a working example to get you started: Page: @page “/modal-test” <BlazorApp1.Components.Modal @ref=”Modal”></BlazorApp1.Components.Modal> <button @onclick=”() => Modal.Open()”>Open Modal</button> @code { private BlazorApp1.Components.Modal Modal { get; set; } } Component: <div class=”modal @ModalClass” tabindex=”-1″ role=”dialog” style=”display:@ModalDisplay”> <div class=”modal-dialog” role=”document”> <div class=”modal-content”> <div class=”modal-header”> <h5 class=”modal-title”>Modal title</h5> … Read more