.NET Core 3.1 Always Encrypted - always-encrypted

I am getting the following error when using .NET Core 3.1 and SQL Always Encrypted. Is this supported in 3.1? Perhaps I am missing something here..
Keyword not supported: 'column encryption setting'.
Currently have the following packages installed
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="3.0.4" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />

Needed to add the following package reference to Microsoft.Data.SqlClient (see nuget) and use this Microsoft.Data.SqlClient and NOT System.Data.SqlClient.
using (var conn = new Microsoft.Data.SqlClient.SqlConnection(connectionString))
{
await conn.OpenAsync();
}

Related

Referenced assembly FSharp.Data.SqlProvider.dll has assembly level attribute but no public type provider classes were found

How to make SQLProvider work in F#? I followed their steps but had few errors.
I run PM> Install-Package SQLProvider
Create a new .fsx script file
Load the dll #r #"C:\src\FSharpDB\DBTest\packages\SQLProvider.1.2.10\lib\net472\FSharp.Data.SqlProvider.dll"
At that stage, I have this warning:
Referenced assembly
'C:\src\FSharpDB\DBTest\packages\SQLProvider.1.2.10\lib\net472\FSharp.Data.SqlProvider.dll'
has assembly level attribute
'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute'
but no public type provider classes were found
If I continue and try to run the example script, it can't recongnised SqlDataProvider:
#r #"C:\src\FSharpDB\DBTest\packages\SQLProvider.1.2.10\lib\net472\FSharp.Data.SqlProvider.dll"
open FSharp.Data.Sql
type Sql = SqlDataProvider<
Common.DatabaseProviderTypes.MSSQLSERVER,
"Server=myServer;Database=myDB;Trusted_Connection=True;">
Error:
The type 'SqlDataProvider' is not defined.
Am I missing anything?
Edit:
As asked in the comments below, more information on the project configuration
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FSharp.Core" version="6.0.1" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="SQLProvider" version="1.2.10" targetFramework="net48" />
<package id="System.IO" version="4.3.0" targetFramework="net48" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net48" />
<package id="System.Runtime" version="4.3.1" targetFramework="net48" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net48" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>

Identity login function stopped working Blazor Wasm Asp.net core hosted

I've been playing with a blazor wasm asp.net core hosted project for a few weeks now, yesterday I added a few controllers on the server side and everything was working fine (Also logging in).. Came back today and identity server just stopped logging in?? I can reach the api (and thus the database) through swagger but when I go to the login page of identity and login with a user the iis just shuts down.. no logs, no idea why. I can register users I can pretty much do anything else but login..
When I login the last thing I see in the debug log console is:
"Name": "Token Issued Success",
"Category": "Token",
"EventType": "Success",
"Id": 2000,
"ClientId": "MyProject.Client",
"ClientName": "MyProject.Client",
"RedirectUri": "https://localhost:44367/authentication/login-callback",
"Endpoint": "Authorize",
"SubjectId": "d0053d07-e530-4e49-acfe-dd9a35a18d12",
"Scopes": "openid profile MyProject.ServerAPI",
"GrantType": "authorization_code",
"Tokens": [
{
"TokenType": "code",
"TokenValue": "****so1w"
}
],
"ActivityId": "80000012-0000-fa00-b63f-84710c7967bb",
"TimeStamp": "2020-09-01T07:57:14Z",
"ProcessId": 23820,
"LocalIpAddress": "::1:44367",
"RemoteIpAddress": "::1"
}
The program '' has exited with code -1 (0xffffffff).
The thread 0x0 has exited with code 0 (0x0).
The program 'localhost:44367' has exited with code -1 (0xffffffff).
The program '[23820] iisexpress.exe' has exited with code -1 (0xffffffff).
Anyone maybe an idea as to why this started happening all of the sudden??
I've read that it might have to do with sdk references so to be as complete as possible I've added my .csproj files for the client, server and the shared projects.
Server:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>MyProject.Server-1C8DF269-9BED-44E5-A7A0-C94CD6D45333</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.7" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.5.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.5.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="5.5.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Client\MyProject.Client.csproj" />
<ProjectReference Include="..\Shared\MyProject.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Client:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="3.2.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.7" />
<PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shared\MyProject.Shared.csproj" />
</ItemGroup>
</Project>
Shared:
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
<PackageReference Include="System.Text.Json" Version="4.7.2" />
</ItemGroup>
</Project>
UPDATE:
After more research I found that this is only happening on the chrome browser.
UPDATE 2:
Tried all configuration options I could find for samesite cookies and those also didn't work, also tried configuring openIdConfiguration but that also didn't work.

wpf app msi created by wix not working due to dependency issue?

Here is my solution.
I have a basic wpf application which uses cefsharp to show google.com. The app works fine when run from my bin folder in VisualStudio itself.
For this application I have created the following WiX file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"><?define WpfApplication6_TargetDir=$(var.WpfApplication6.TargetDir)?>
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="acv" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SetupProject1" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject1" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<Component Id="WpfApplication6.exe" Guid="*">
<File Id="WpfApplication6.exe" Name="WpfApplication6.exe" Source="$(var.WpfApplication6_TargetDir)WpfApplication6.exe" />
</Component>
<Component Id="WpfApplication6.exe.config" Guid="*">
<File Id="WpfApplication6.exe.config" Name="WpfApplication6.exe.config" Source="$(var.WpfApplication6_TargetDir)WpfApplication6.exe.config" />
</Component>
<Component Id="CefSharp.WinForms.dll" Guid="*">
<File Id="CefSharp.WinForms.dll" Name="CefSharp.WinForms.dll" Source="$(var.WpfApplication6_TargetDir)CefSharp.WinForms.dll" />
</Component>
<Component Id="CefSharp.dll" Guid="*">
<File Id="CefSharp.dll" Name="CefSharp.dll" Source="$(var.WpfApplication6_TargetDir)CefSharp.dll" />
</Component>
<Component Id="CefSharp.Core.dll" Guid="*">
<File Id="CefSharp.Core.dll" Name="CefSharp.Core.dll" Source="$(var.WpfApplication6_TargetDir)CefSharp.Core.dll" />
</Component>
</ComponentGroup>
</Fragment>
This code creates the setup, and when the application runs after installing the following exception occurs: Could not find cefsharp.core or one of its dependencies is not loaded.
This error appears when Visual c++ is not present.
How do I fix this, as I have Visual c++ installed.
Should I add any references in my WiX file?

Wix installer error code 2343 received for a simple configuration. (WIX Newbie)

I am receiving the following error when using the following simple WIX configuration. The application being installed is WPF.
Product: Web Miner Installer -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2343. The arguments are: , ,
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Application Title" Language="1033" Version="1.0.0.0" Manufacturer="Avant Prime" UpgradeCode="855a8b6e-c576-41e2-8118-8f3511613478">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="Application Title" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<DirectoryRef Id="ShortcutFolder">
<Component Id="ShortcutsComponent" Feature="ProductFeature" Guid="{B40F2C3F-CACC-4196-8F8F-C0F6B082404E}">
<CreateFolder Directory="ShortcutFolder" />
<RemoveFolder Id="RemoveShorcutFolder" Directory="ShortcutFolder" On="uninstall" />
<Shortcut Id="UninstallProduct"
Name="Uninstall xxxxxxx"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"
Directory="ShortcutFolder"
Description="Uninstalls xxxxxxx"/>
<RegistryValue Id="RegistryShortcut"
Root="HKCU"
Key="SOFTWARE\xxxxxx\settings"
Name="Shortcut"
Value="1"
Type="integer"
KeyPath="yes" />
</Component>
</DirectoryRef>
<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="This setup requires the .NET Framework 4.5.1 to be installed.">
Installed OR NETFRAMEWORK45
</Condition>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramMenuFolder">
<Directory Id="ShortcutFolder" Name="xxxxxx"></Directory>
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="xxxxxxx" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.MyApplication.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
What am I missing or doing wrong?
Here is the requested log information. It is big so I attached a link.
WIX Installer Error Log
You should replace INSTALLLOCATION with the real property (INSTALLFOLDER in your case)

Log4net not printing to console in wpf

I have a WPF application with 2 log4net appenders in log4net, the first printing to file and the second should print to console.
For some reason I am not being able to show the result on log4net, but I do see it in the file. What is wrong?
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\\Temp\\1.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<param name="Header" value="[Header]\r\n" />
<param name="Footer" value="[Footer]\r\n" />
<param name="ConversionPattern" value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Do you see a console pop up when you start the application.
It could be you have to configure your application as a console project to have a console window...
Otherwise you can check trace info. Normally an appender tries to leave one error message there if he can't log to the desired location.
Output window of visual studio catches trace messages when debugging...
Possible duplicate: Log4net won't log to console (WinForms app)
If you are wanting to see the messages in the output window in visual studio you should use the following instead:
<appender name="TraceAppender" type="log4net.Appender.TraceAppender" >
Do you call once XmlConfigurator.Configure() ?

Resources