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
414 stars 94 forks source link

Sample TestApp & TestAppWinforms executables do not run on Windows 10/11 #222

Closed dotriz closed 1 year ago

dotriz commented 1 year ago

I we build project and take the contents of bin folder to a Windows 10 22H2 PC, executables do not run. PC has VC++ runtimes and .Netframework4.7.2 installed. What else needs to be there to make it work?

sskodje commented 1 year ago

If it's a normal windows 10 install, you should just need the VC++ runtime. If it's one of the Windows N version, you need to install media feature pack. If it's Windows Server, then media features must be enabled in role and features manager.

You can use Event Viewer to see the error, if it crashes on launch due to missing dependencies.

dotriz commented 1 year ago

Yes, its a normal Windows 10 Pro and VC++ runtime is installed too.

sskodje commented 1 year ago

Make sure that if compiled for x64 you must install x64 vc++ runtime, and likewise when compiled for x86 you mist install x86 vc++ runtime. Without more info, i can't really help.

dotriz commented 1 year ago

x64 VC++ runtime on a Win10 pro x64 is installed. This is the exact error I get on Windows 10 when I run Winform project from this example. WPF project doesn't give any error and doesn't open too.

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** System.IO.FileNotFoundException: Could not load file or assembly 'ScreenRecorderLib.dll' or one of its dependencies. The specified module could not be found. File name: 'ScreenRecorderLib.dll' at TestAppWinforms.Form1.RecordButton_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

----- Loaded Assemblies ----- mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.8.4515.0 built by: NET48REL1LAST_C CodeBase: file:///F:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

TestAppWinforms Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///F:/Users/mrizw/Downloads/screenrec-win/TestAppWinforms.exe

System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.8.4550.0 built by: NET48REL1LAST_C CodeBase: file:///F:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System Assembly Version: 4.0.0.0 Win32 Version: 4.8.4536.0 built by: NET48REL1LAST_C CodeBase: file:///F:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C CodeBase: file:///F:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B CodeBase: file:///F:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.8.4590.0 built by: NET48REL1LAST_B CodeBase: file:///F:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.8.4084.0 built by: NET48REL1 CodeBase: file:///F:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

----- JIT Debugging ----- To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled.

For example:

When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.

sskodje commented 1 year ago

System.IO.FileNotFoundException: Could not load file or assembly 'ScreenRecorderLib.dll' or one of its dependencies. The specified module could not be found. File name: 'ScreenRecorderLib.dll'

This error usually means a conflict between x86 and x64 dependencies. Check that both the library and the test app is compiled for x64. And if they are compiled for x86, you need to install the vc++ x86 runtime.

dotriz commented 1 year ago

Exe and dll are both compiled for x64. And see all x64 VC++ runtimes installed. image

sskodje commented 1 year ago

You can try the DLLs from here or one of the automatic test app builds from here. If they work, there's something going wrong with the compiling or copying of the files.

dotriz commented 1 year ago

I think you are right. That was the issue. Thanks.