sskodje / ScreenRecorderLib

A .NET library for screen recording in Windows, using native Microsoft Media Foundation for realtime encoding to h264 video or PNG images.
MIT License
417 stars 95 forks source link

System.AccessViolationException #328

Open arshadch123 opened 1 week ago

arshadch123 commented 1 week ago

On the following line when it start recording it show Systm.AccessViolationException: Attemp to read or write protected memory. This is often an indication that other memory is corrupt.

_recorder = ScreenRecorderLib.Recorder.CreateRecorder(opts);

This exception is on some computers not all.

Any solution please.

sskodje commented 1 week ago

I can't say from such a generic error. If you can post logs perhaps i can help more. Configure logging for Trace for best detail.

Jason-Tan-ISJ commented 6 days ago

I have the same problem as well, on window 10 IOT Enterprise version, there is no problem on my window 11 development machine, what i get from the debug, it shows below..

Exception thrown at 0x00007FFE2A723020 (msvcp140.dll) in TestConsoleAppDotNetCore.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

on the console, it shows below: Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Repeat 2 times:

at .RecordingManager.{ctor}(RecordingManager*)

at ScreenRecorderLib.Recorder..ctor(ScreenRecorderLib.RecorderOptions) at ScreenRecorderLib.Recorder.CreateRecorder(ScreenRecorderLib.RecorderOptions) at Program.Main(System.String[])

C:\Users\xxxx\ScreenRecorderLib-master\TestConsoleAppDotNetCore\bin\x64\Debug\net8.0\TestConsoleAppDotNetCore.exe (process 6100) exited with code -1073741819. To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.

Is there any solution?

Edit : i found this article below and I try rollback using ScreenRecorderLib version from 6.3.0 to 6.2.0, apparently the error didn't appear anymore.. maybe this would help to look into the problem..

https://developercommunity.visualstudio.com/t/msvcp140dll-crash-mutex-with-code-built/10753114?sort=newest&topics=visual+studio+2017

sskodje commented 6 days ago

Thats very interesting, and may very well be the cause. I'll compile with the flag for next release, to avoid people having to upgrade redistributables.