Skip to content

Instantly share code, notes, and snippets.

View richlander's full-sized avatar

Rich Lander richlander

View GitHub Profile
@richlander
richlander / dotnetcore-winforms.csproj.xml
Last active September 28, 2023 19:38
.NET Core WinForms App
<ProjectSdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
@richlander
richlander / dotnet-core-wpf.csproj.xml
Last active December 4, 2018 17:32
WPF .NET Core Application
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>
@richlander
richlander / dotnetcore.csproj.xml
Created December 4, 2018 16:14
Minimal .NET Core Application
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
@richlander
richlander / runtime-events.cs
Created December 4, 2018 15:36
.NET Runtime Events API
internal sealed class SimpleEventListener : EventListener
{
// Called whenever an EventSource is created.
protected override void OnEventSourceCreated(EventSource eventSource)
{
// Watch for the .NET runtime EventSource and enable all of its events.
if (eventSource.Name.Equals("Microsoft-Windows-DotNETRuntime"))
{
EnableEvents(eventSource, EventLevel.Verbose, (EventKeywords)(-1));
}
@richlander
richlander / sqlconnection-access-token.cs
Created December 4, 2018 15:33
Support for AccessToken in SqlConnection
// get access token using ADAL.NET
var authContext = new AuthenticationContext(authority);
var authResult = await authContext.AcquireTokenAsync(appUri, clientCredential);
// setup connection to SQL Server
var sqlConnection = new SqlConnection(connectionString);
sqlConnection.AccessToken = authResult.AccessToken;
await sqlConnection.OpenAsync();
@richlander
richlander / timing.md
Last active September 11, 2018 18:42
.NET Core Basic Perf Timing

.NET Core 3.0 Perf Timing for basic operations

The following are rough results, comparing .NET Core 3

.NET Core 3.0 AMD64 on Windows 10 AMD64 Desktop PC

C:\Users\rlander> (measure-command { dotnet --version }).TotalSeconds
0.1316636
C:\Users\rlander> (measure-command { dotnet new console -o app }).TotalSeconds
@richlander
richlander / instructions.md
Last active March 24, 2024 14:54
Installing .NET Core 3.0 on Linux ARM64

Installing .NET Core on Linux ARM64

The following intructions can be used to install .NET Core on Linux ARM64.

Pro tip: Check out .NET Core Docker files to determine the exact instructions for installing .NET Core builds, for example .NET Core 3.1 ARM32 SDK Dockerfile.

Installing .NET Core Globally

The following instructions install the latest .NET Core globally. It isn't required to do that, but it provides the best experience.

@richlander
richlander / tieredcompilation.csproj.xml
Last active August 2, 2018 23:22
.NET Core Project File with Tiered Compilation Enabled
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TieredCompilation>true</TieredCompilation>
</PropertyGroup>
</Project>
@richlander
richlander / dotnet-docker-limits-test.md
Last active August 29, 2019 19:55
.NET Core Docker Limits Test

.NET Core Docker Limits Test

Docker enables you to limit a container's resources. This control is great for high-density hosting and other low-resource scenarios. Developers have the expectation that the application platform respects these limits and does its best to work within them.

I wrote a crude test framework to determine how .NET Core behaves when various resource limits are set. The following are the results.

The testing varied the following:

  • Host OS
  • Server vs Workstation GC