temporalio / sdk-dotnet

Temporal .NET SDK
MIT License
363 stars 27 forks source link

Support .NET Trimming #286

Open angusbjones opened 1 month ago

angusbjones commented 1 month ago

What are you really trying to do?

Publish trimmed/aot-compatible dotnet applications.

Describe the bug

Temporalio (and other packages) don't have trimming annotations included which produces errors when publishing with trimming enabled.

Minimal Reproduction

  1. Download the sample at src/AspNet/Worker.
  2. Modify TemporalioSamples.AspNet.Worker.csproj to include <PublishTrimmed>true</PublishTrimmed>
  3. Run dotnet publish on TemporalioSamples.AspNet.Worker.csproj.

Environment/Versions

cretz commented 1 month ago

I think this is not a bug, but rather a feature request to have the SDK support trimming. There are some things we'll have to do since we use PInvoke and reflection in some places. We will keep this open as a feature request for trimming support and if it garners enough interest, we can look into annotating the SDK for it and running all tests while trimmed to ensure it works and continues to.