Skip to content

Suppress CS1701/CS1702 binding-redirect warnings from Add-Type on PowerShell Core #132

Closed

Description

@jamescrosswell

Add-Type in Sentry.psm1 emits CS1701/CS1702 warnings on PowerShell Core if the host's runtime System.Runtime version doesn't match the one Sentry.dll was compiled against. The binding still succeeds and the module works — these warnings are informational, not failures — but they're noisy and look alarming on every module import:

Add-Type: error CS1701: Assuming assembly reference 'System.Runtime, Version=9.0.0.0, ...' used by 'Sentry' matches identity 'System.Runtime, Version=10.0.0.0, ...' of 'System.Runtime', you may need to supply runtime policy

Pass /nowarn:CS1701;CS1702 via -CompilerOptions to silence the noise while still letting real compile errors surface. -CompilerOptions\ is PowerShell Core only, so guard with \$PSEdition -eq 'Core'.

Activity

  1. linear-code commented on May 25, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions