Skip to content

[NativeAOT] BouncyCastle SIGARBT -1 #118058

@thefex

Description

@thefex

Description

I am deploying native library to arm64 (in that case linux-bionic-arm64) but I suspect this is not this target specific.

Whenever I use https://www.nuget.org/packages/BouncyCastle.Cryptography library it crash during new SecureRandom()

I copy pased this classes into my project manually and I found it crash whenever Span<byte> is created with stackalloc byte array and then manipulated later on.

Is stackalloc available within nativeaot compilation?
It seems to does not work with spans.

Btw:

  • I preserve all assemblies with IlLink.Descriptors so I dont think that is trimmer issue

Reproduction Steps

  1. Reference BouncyCastle.Cryptography
  2. Call new SecureRandom()
  3. build with nativeaot compilation
  4. sigarbt -1

Expected behavior

App should not crash

Actual behavior

SIGABRT -1 native crash

Regression?

No response

Known Workarounds

Dont use stackallocs with spans but… seems thats the bug

Configuration

.net 9.0.301

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions