Hi,
I have a C# Console application built in VS Professional 2017 (.NET Framework 4.6) with Target Platform set to x86.
It is calling Unmanaged Dlls which are built with Platform “Active(Win32)”.
Below is my C# code where I am getting the error:
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if( obj == null )
obj = MainFrame.GetMainFrameInstance(args);
Application.AddMessageFilter(obj);
if (PriorProcess() != null)
{
if (obj.WindowState == FormWindowState.Minimized)
{
obj.WindowState = FormWindowState.Maximized;
}
return;
}
objEMRBrowserMutex = new Mutex( true, "Local\\EMRBrowserMutex" );
Application.Run(obj);
if (objEMRBrowserMutex != null)
{
objEMRBrowserMutex.ReleaseMutex();
}
}
From the Main function we are calling the below function and here we are getting the exception:
System.IO.FileNotFoundException: 'Could not load file or assembly 'UIControl.dll' or one of its dependencies. The specified module could not be found.'
public static MainFrame GetMainFrameInstance(string[] args)
{
if (mainFrameObj == null)
{
lock (syncRoot)
{
mainFrameObj = new MainFrame(args);
}
}
return mainFrameObj;
}
Here, args showing {string[0]}
1.
Do I need to use try and catch for "Application.Run"
like as shown below or is it not needed because anyway from the error we got to know that "Could not load 'UIControl.dll' ?
try
{
Application.Run(obj);
}
catch(FileNotFoundException excep)
{
MessageBox.Show("Missing file is : " + excep.FileName);
}
2.
FYI, UIControl.dll is a wrapper written for marshaling purpose between managed to unmanaged calling. I tried to add UIControl.dll from (Add -> Reference). Even after i added the .dll is not showing as selected in Reference Manager
I have a C# Console application built in VS Professional 2017 (.NET Framework 4.6) with Target Platform set to x86.
It is calling Unmanaged Dlls which are built with Platform “Active(Win32)”.
Below is my C# code where I am getting the error:
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if( obj == null )
obj = MainFrame.GetMainFrameInstance(args);
Application.AddMessageFilter(obj);
if (PriorProcess() != null)
{
if (obj.WindowState == FormWindowState.Minimized)
{
obj.WindowState = FormWindowState.Maximized;
}
return;
}
objEMRBrowserMutex = new Mutex( true, "Local\\EMRBrowserMutex" );
Application.Run(obj);
if (objEMRBrowserMutex != null)
{
objEMRBrowserMutex.ReleaseMutex();
}
}
From the Main function we are calling the below function and here we are getting the exception:
System.IO.FileNotFoundException: 'Could not load file or assembly 'UIControl.dll' or one of its dependencies. The specified module could not be found.'
public static MainFrame GetMainFrameInstance(string[] args)
{
if (mainFrameObj == null)
{
lock (syncRoot)
{
mainFrameObj = new MainFrame(args);
}
}
return mainFrameObj;
}
Here, args showing {string[0]}
1.
Do I need to use try and catch for "Application.Run"
like as shown below or is it not needed because anyway from the error we got to know that "Could not load 'UIControl.dll' ?
try
{
Application.Run(obj);
}
catch(FileNotFoundException excep)
{
MessageBox.Show("Missing file is : " + excep.FileName);
}
2.
FYI, UIControl.dll is a wrapper written for marshaling purpose between managed to unmanaged calling. I tried to add UIControl.dll from (Add -> Reference). Even after i added the .dll is not showing as selected in Reference Manager
I am beginner in C# programming. Please help me how to resolve the issue. And please provide your thoughts for marshaling and adding the references from C#.