Windows form project and VideoUltimate
Question asked by Olivier TELLE - 1/2/2020 at 7:27 AM
Hello from France,

I am a beginner.
I try to use VideoUltimate on a windows form project.

I get an error : "System.IO.FileNotFoundException : 'Unable to load file or assembly 'VideoEngine, Version=, Culture=neutral, PublicKeyToken=a6f3cafa178e6038.' "

Could you please give me an hand with this event ?


3 Replies

Reply to Thread
Cem Alacayir Replied
Employee Post
Some DLLs are embedded in GleamTech.Common.dll and GleamTech.VideoUltimate.dll and they are resolved automatically when they are requested however internal AssemblyResolver should be initialized first. In Web Applications, this is handled automatically because it can know when the application is started by hooking up.

For Winforms or Console project, in your Main method (entry point in program.cs) add this line:

var dummy = VideoUltimateConfiguration.Current;
This will make sure AssemblyResolver is initialized on startup and you should not get "Unable to load file or assembly" errors. Basically accessing a type in GleamTech.VideoUltimate.dll on startup will solve the issue.
Olivier TELLE Replied
Thank you, 
It works well with the following syntax :
Dim dummy = VideoUltimateConfiguration.Current

Cem Alacayir Replied
Employee Post Marked As Answer
FYI, this actually turned out to be a bug since v1.9.18.

With v2.1.5, you no longer need to use the above workaround and it should work out of the box.

Version 2.1.5 - January 9, 2020

  • Fixed: "Unable to load file or assembly 'VideoEngine ..." error after adding VideoUltimate to a non-web project (Windows Forms, Console).The same error also happened if you did not you call AddGleamTech and UseGleamTech methods in an ASP.NET Core project.

  • Improved: Stability of video processing.

  • Added: New GleamTechConfiguration.EnsureAssemblies method which ensures GleamTech's assemblies are loaded and initialized.You may need to call this method in entry point/startup of your application, if you receive "Could not load file or assembly ..." errors.
    Some DLLs are embedded inside GleamTech's DLLs and they are resolved automatically when they are requested howeverinternal AssemblyResolver should be initialized first and internal AssemblyResolver of each GleamTech DLL can be initializedonly when a type inside that DLL is accessed first. So in some cases, even a GleamTech DLL is loaded, its AssemblyResolvermay not be initialized yet (because none of its types is accessed yet). You can observe this behaviour if your applicationcalls some methods which scans assemblies for reflection purpose (reflection-only type access does not trigger DLL's module initializer),for example ASP.NET Core's endpoints.MapControllers method and SimpleInjector's RegisterMvcControllers method.So to prevent errors on those methods, you can call this method before such methods.
    Note that you should not need to call this method usually for web applications, because it is handled automaticallyas we can know when the application is started by hooking up (automatically in ASP.NET Classic and when you call AddGleamTech andUseGleamTech methods in ASP.NET Core).

  • Changed: In previous versions, invalid values for GleamTech related configuration keys (e.g in Web.config or appsettings.json) wassilently ignored (exceptions were swallowed). From now on, invalid property values in config files will throw exceptions just like whenthey are set in code. This is especially useful for "VideoUltimate:LicenseKey" property, i.e you should instantly know if you put an invalid licensekey (empty string for "VideoUltimate:LicenseKey" property will also throw) without silently falling back to trial mode.

Only for some edge cases, you can use this new method (described above) instead of the workaround:


Reply to Thread