-
-
Notifications
You must be signed in to change notification settings - Fork 229
Description
NLog 5.2.2 added trimming support. With growing adoption of MAUI, more and more users are trying to trim their apps.
We need to:
- Bump to 5.2.2
- Provide enough information about the custom configuration type used with NLog that it either doesn't try to load certain properties or the linker preserves any types required to load those properties.
Worth investigating @snakefoot 's comment about the complexity of the SentryNLogOptions class. If people are only using the NLog integration then ideally they'd be putting all of their Sentry config in one place, but maybe worth challenging that as it creates additional complexity (like this) elsewhere.
Originally posted by @snakefoot in #3680
Think the Sentry.NLog project should update to NLog v5.2.2 (or newer).
And then you should provide a registration-method, that marks the relevant types in Sentry.NLog to not be trimmed (This already happens for all types inside NLog):
NLog.LogManager.Setup().SetupExtensions(ext => { ext.RegisterTarget<Sentry.NLog.SentryTarget>(); ext.RegisterType<Sentry.NLog.SentryNLogOptions>(); });You should probably avoid mixing options that are not intended to be assigned from NLog-configuration-file. Maybe SentryNLogOptions should not inherit from SentryOptions. But should instead just expose the properties that are intended to be assigned from NLog-configuration-file. Then you could have a property in SentryNLogOptions marked like this:
[NLogConfigurationItem] public class SentryNLogOptions { [NLogConfigurationIgnoreProperty] public SentryOptions SentryOptions { get; } = new SentryOptions(); public int ShutdownTimeoutSeconds { get => (int)SentryOptions.ShutdownTimeout.TotalSeconds; set => SentryOptions.ShutdownTimeout = TimeSpan.FromSeconds(value); } }Notice the AOT-issues that NLog v6 will be fixing is removing the dependency on RegEx and XmlReader and ExpressionTrees, since they include code-generation-abilities and there is no JIT-compiler included with pure AOT-builds.
Metadata
Metadata
Assignees
Labels
Projects
Status
Status