Author Topic: .Net 9 Preview 6 causes all BASS calls to instantly crash app  (Read 378 times)

pgruebele

  • Posts: 94
I just updated my app to .Net 9 preview 6 and all bass calls started crashing the app.  With Preview 5 things worked.  The rest of my app is working normally so this is some incompatibility between Bass and the latest .Net 9 Preview 6.

The error message is "... has exited with code 3221226505 (0xc0000409)." which seems to mean STATUS_STACK_BUFFER_OVERRUN so could this be an existing issue that is only no detected by the runtime?

I updated to the latest bass libraries and there is no change.

The native stack trace looks like this:
    KernelBase.dll!00007fff8a431f1e()   Unknown   No symbols loaded.
   bass.dll!00007ffede4f7004()   Unknown   No symbols loaded.

The exception says:
      Unhandled exception at 0x00007FFF8A431F1E (KernelBase.dll) in soundjar.exe: Unknown __fastfail() status code: 0x0000000000000039.


« Last Edit: 13 Jul '24 - 11:23 by pgruebele »

radio42

  • Posts: 4839
I haven't tried that latest preview myself, as I also don't see any advantage yet to migrate immediately.
But maybe this is a bug in the preview of .Net?

pgruebele

  • Posts: 94
I will wait for Preview7 and try again.  For now I reverted to Preview 5 because of this issue...

pgruebele

  • Posts: 94
Looks like .net 9 RC1 will be released shortly.  There is a breaking change regarding removal of BinaryFormatter: https://github.com/dotnet/runtime/issues/98245

If this is functionality the Bass .Net wrapper uses then this could explain the crash.  If not then I will test with RC1 and post back...

pgruebele

  • Posts: 94
I did not hear back from you so I scanned your .net assembly and it looks like you indeed have references to BinaryFormatter which will throw exceptions in the .Net 9 release.  Not sure that these are causing my particular issue but this will certainly cause issues.

Here is the relevant post: https://github.com/dotnet/runtime/issues/98245

pgruebele

  • Posts: 94
I just updated to the newly released .Net 9 Preview 7 and bass still crashes.

I think it is very unlikely that this is a .Net bug at this point and it is a show stopper for me.  Can you recreate this issue and publish a fix?

Thanks!

Ian @ un4seen

  • Administrator
  • Posts: 26015
If you catch the crash in the debugger (in mixed mode), does the call stack lead back to a line in your code, and if so, what is it? Are you also able to reproduce the crash with any of the examples that come with BASS.Net?

pgruebele

  • Posts: 94
Yes I upgraded the sample "simple.csproj" and it fails identically (see attaches screenshot).

I am also attaching the upgraded simple sample csproj for your convenience.


Ian @ un4seen

  • Administrator
  • Posts: 26015
OK, that looks like it's crashing in the BASS_Init call. If you put a different BASS function call before that, does it crash at that call instead? Please also confirm what BASS version you're using, ie. what BASS_GetVersion returns. And if you haven't already done so, try the latest build:

   www.un4seen.com/stuff/bass.zip

pgruebele

  • Posts: 94
I am already using the latest version from your download page.  Any call to bass crashes, not just bass init...

Ian @ un4seen

  • Administrator
  • Posts: 26015
The BASS build linked above is newer than the one on the BASS webpage. Please reproduce the crash with it and (if it still happens) then use the debugger's "Save Dump As..." option to get a dump file, and ZIP and upload that to have a look at here:

   ftp.un4seen.com/incoming

pgruebele

  • Posts: 94
With the latest version from your link the crash no longer happens.  Can I safely use this newer version?  It appears to use some additional DLLs...

pgruebele

  • Posts: 94
Unfortunately with our app bass still crashes even with your latest version.  But we use a bunch of add-ons so in that sense our app is different from the simple sample app.

Are there newer versions of all the other DLLs including bass.net to try out?

pgruebele

  • Posts: 94
It is still crashing later in our application as shown in the attached screenshot (the bass init call no longer crashes with your latest bass.dll).

Ian @ un4seen

  • Administrator
  • Posts: 26015
Looks like it's in BASSmix now. An updated build of that is available here:

   www.un4seen.com/stuff/bassmix.zip

Regarding the BASS.DLL update, there are no known issues with it, so it should be safe to use. It imports the same DLLs as the release version, so there shouldn't be any difference there - what additional DLLs are you seeing?

pgruebele

  • Posts: 94
The updated bassmix allows our app to pass that line but then it has the same crash on the next line at:

    Un4seen.Bass.AddOn.Enc.BassEnc.BASS_Encode_GetVersion()

I am guessing that if you fix that then the next line will crash as well so all the bass libraries need updating?

Ian @ un4seen

  • Administrator
  • Posts: 26015
A BASSenc update is available here:

   www.un4seen.com/stuff/bassenc.zip

If there are any other add-ons affected, please try modifying this URL with the add-on's name to see if there's an updated version of that available too.

pgruebele

  • Posts: 94
bassenc appears to have been the last problematic one.  Also never mind about the extra DLL loading.  Some DLLs just weren't being loaded previously due to the crash...

Ian @ un4seen

  • Administrator
  • Posts: 26015
Good to hear that it's all working now. I think I know what it was - it's apparently related to the way that the 64-bit Windows DLLs were being built in 2022 (until December). The 3 affected DLLs were built in that time. All 3 are actually due for new releases soonish, but I'll get some rebuilds up on the BASS page in the meantime, although I would usually recommend using the latest builds (above) instead anyway.