Skip to content

LNK4291 Warning when compiling WinExe w/ Native AOT #4801

@Sella-GH

Description

@Sella-GH

Package

Sentry.Extensions.Logging

.NET Flavor

.NET Core

.NET Version

10.0.101

OS

Windows

OS Version

26220.7344

Development Environment

Visual Studio v18.x

SDK Version

5.16.2

Self-Hosted Sentry Version

No response

Workload Versions

Workloadversion: 10.0.101

Installed Workload-ID         Manifestversion          Install Source
--------------------------------------------------------------------------------------
android                       36.1.2/10.0.100          SDK 10.0.100, VS 18.3.11304.161
ios                           26.1.10502/10.0.100      SDK 10.0.100, VS 18.3.11304.161
maccatalyst                   26.1.10502/10.0.100      SDK 10.0.100, VS 18.3.11304.161
macos                         26.1.10502/10.0.100      SDK 10.0.100, VS 18.3.11304.161
maui-windows                  10.0.1/10.0.100          SDK 10.0.100, VS 18.3.11304.161

UseSentry or SentrySdk.Init call

public void AddAppTelemetryLogging(string dsn)
{
    logging.AddSentry(o =>
    {
        o.Dsn = dsn;
        o.IsGlobalModeEnabled = true;
        o.CaptureFailedRequests = true;
        o.Environment = OsUtils.GetAppEnvironment;
        o.Release = OsUtils.GetAppVersion.ToString();
        o.SendClientReports = true;
        o.TracesSampleRate = 0;
        o.UseAsyncFileIO = true;

        // Needed because of NAOT
        o.DisableWinUiUnhandledExceptionIntegration();
    });
}

Steps to Reproduce

This should be the same (or kinda the same) issue as here: MartinKuschnik/WmiLight#57

  1. Set the property ControlFlowGuard to Guard in .csproj
  2. Enable NAOT Compilation in csproj
  3. Publish via dotnet publish to ensure NAOT Compilation

Expected Result

No warnings.

Actual Result

sentry-native.lib(sentry_attachment.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_core.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_database.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_envelope.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_json.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_logs.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_options.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_os.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_ringbuffer.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_scope.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_session.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_transport.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_utils.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_value.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_tracing.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_path.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_path_windows.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_process_windows.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_modulefinder_windows.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_backend_inproc.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_unwinder_dbghelp.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata
sentry-native.lib(sentry_screenshot_windows.obj) : warning LNK4291: module may contain '__except' (Structured Exception Handling) but was not compiled with /guard:ehcont; generating conservative metadata

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .net codeBugSomething isn't working

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions