bitwarden / bitwarden/passwordless-dotnet

Add support for assembly trimming and AOT

Open
#132 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
52
Forks
17
PR merge metrics
No merged PRs in 30d

Description

#130 added annotations for APIs that dynamically reference code (usually through reflection). These methods are, in essence, in compatible with trimming/AOT.

This means that the only available way to set up the raw Passwordless.dev SDK is by using this overload, which requires configuring the options manually:

```csharp
public static IServiceCollection AddPasswordlessSdk(
this IServiceCollection services,
Action configureOptions)
```

For the Identity integration package, we currently offer no way to add Passwordless.dev in a way that works with trimming/AOT.

Some of it may be a side-effect of the nature of ASP.NET Core as the foundation, but Microsoft is already rolling out certain alternative APIs to help support trimming/AOT scenarios. For example, for the configuration binding, we can use [this](https://andrewlock.net/exploring-the-dotnet-8-preview-using-the-new-configuration-binder-source-generator) approach to avoid reflection.

Contributor guide

Open the contributing guide

Research direction

Start with the AddPasswordlessSdk overload that accepts Action and review how the Identity integration package currently registers Passwordless.dev. Read the linked .NET configuration-binder source-generator approach and assess which APIs are affected by reflection, trimming, and AOT. Done means the raw SDK and Identity integration have documented, usable setup paths that support trimming/AOT.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.