How to solve stackoverflow exception in .NET library

I have downloaded the example provided here and updated all NuGet packages

Stackoverflow exception happened when I tried on relatively long audio file which is 1 hour 37 minutes : 182 mb

The wav file is correctly formatted. I have tested with smaller splits

The software throws this error how can I solve that?

Please read the guidelines: What and how to report if you need support

Specifically, screenshots are unactionable: unreadable, not accessible.

So ? Care to elaborate here ? You reach for help, but you don’t bother explaining what you do. Have smaller file been successfull?

You could first follow the guidelines. Like, we still don’t know what is your error, besides “Stackoverflow exception”, we don’t know what part of the code triggered it, etc.

As documented, those examples are user-contributed and provided with no guarantee.

So the code works. My guess is you are exhausting resources. But again, without more context, code, hardware, …

Ok I want to ask something. As displayed on screenshot, it absolutely shows no other information because it is an error thrown by Mozilla Deep Speech.NET library DLL. So how can I provide more information?

And if hardware were problem I would know that. I am checking and have plenty of ram memory and hard drive space.

This is the code that thrown that error

DeepSpeechClient.DeepSpeech deepSpeechClient =
 new DeepSpeechClient.DeepSpeech("deepspeech-0.8.2-models.pbmm");

deepSpeechClient.EnableExternalScorer("deepspeech-0.8.2-models.scorer");

var AudioFilePath = $"{srFileName}";

var waveBuffer = 

new NAudio.Wave.WaveBuffer(File.ReadAllBytes(AudioFilePath));
 
   using (var waveInfo = new NAudio.Wave.WaveFileReader(AudioFilePath))
{
    DeepSpeechClient.Models.Metadata vrMeta = deepSpeechClient.SpeechToTextWithMetadata(
    waveBuffer.ShortBuffer,             
   Convert.ToUInt32(waveBuffer.MaxSize / 2), 1);
}

By the way I have splitted file into the 12 equal pieces and trying that way now. So I hope wont have stackoverflow exception and also have now multi-threading capability.

Edit : After splitting audio file into the 12 equal pieces, it worked without any problem. So definitely there is a bug in the library.

Ok, so you continue to completely ignore my requests for stopping sharing useful informations as screenshots. I have been patient enough, already.

There is no such thing as “DeepVoice”. I can’t read your error, so I can"t help you.

and yet “stack overflow” can be consistent with hardware resources exhaustion?

@MonsterMMORPG Hello, my guess is that the file size is over the converttouint limit, let me try it and confirm.

@carlfm01 thanks for checking.

After I did split the long wav file into the smaller pieces, they processed without any problem. Definitely something related to library.

Also it doesn’t throw exception immediately. It runs a while and then throws the exception.

Please try, investigate and repro from the C interface, because I remember @carlfm01 mentionned some inefficiencies in the .Net interface, and it could just be a side-effect of that.

I’m able to reproduce and confirm this a library side issue, tomorrow I will debug and see if I can fix it

@carlfm01 - Very curios if you managed to fix this issue as I am facing the same issue above