Open MrPG8 opened 4 years ago
Which version of LegacyWrapper did you use?
I also experience the same issue, with version 3.0 (latest code). My sample app is WinForm, it also raised exception 'The provided interface type
@stevetiger03 so, is your interface public? ;) This could also mean that the assembly containing the interface is not visible from your calling code.
Sorry for the late reply, I did not get any notifications until 4 days ago.
As it turns out, the issue was caused by insufficient permissions. So the error message 'The system cannot find the file specified' was pretty accurate. If anyone else runs into issues like this, check your app permissions (and the DLLs). This issue is not caused by LegacyWrapper.
I'm not sure I understand what is happening. I'm having the same error message. I call the path directly i.e. "C:\Blah\Blahblah\Dis.dll" Do you mean check the securtiy permissions inthe context menu?
What is the actual error message you receive? Is your interface public?
[LegacyDllImport("C:\\CNCWorkbench\\Control\\CAN\\CanApi.dll")]
public interface IselImport : IDisposable
{
[LegacyDllMethod(CallingConvention = CallingConvention.Winapi)]
uint mctl_Initialize([MarshalAs(UnmanagedType.LPStr)] string szInitFile);
uint mctl_Exit();
uint mctl_Reset();
uint mctl_Reference(uint dwAxis);
uint mctl_GetStatus(ref MCTLSTATUS lpMCTLStatus, uint dwSize);
uint mctl_GetAxisStatus(ref AXISSTATUS lpAxisStatus, uint dwSize);
uint mctl_SetVelocity(ref MCTLVELOCITY lpMctlVelocity, uint dwSize);
uint mctl_GetVelocity(ref MCTLVELOCITY lpMctlVelocity, uint dwSize);
uint mctl_MoveAbs(ref AXISPOS lpAbsPos, uint dwSize);
uint mctl_FastAbs(ref AXISPOS lpAbsPos, uint dwSize);
uint mctl_GetPosition(ref AXISPOS lpPosition, uint dwSize);
}
Faults at the using here:
using(var client = WrapperProxyFactory<IselImport>.GetInstance(m_WrapperConfig))
{
if (!TableStatus.fInitialized)
{
CurrentReturn = client.mctl_Initialize(m_iniFile);
It's the same error. "The System cannot find the file specified."
Well, it was a long time ago, but it pretty much comes down to either the file can not be found (in your case that is not likely as you specified the full path) or insufficient rights. Have you tried running your program as administrator or making sure the file can be accessed by your program or the .dll isn't blocked by windows?
Full Control permision on all folders and files on the Application path an the API path. Running as administrator on the application.
Is there any other way you can think of That windows would block the file?
The API works in DLLImport while on 32-bit, But I have another SDK that is 64-bit
I am trying to call a 32-bit DLL from an asp.net mvc website (which is running in a 64-bit application pool), but I keep getting this exception: "The system cannot find the file specified".
I am certain I'm doing something wrong, could you please point me into the right direction?
I'm using the sample code provided:
Stack trace:
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at LegacyWrapperClient.Transport.PipeConnector..ctor(IFormatter formatter, IWrapperProcessStarter wrapperProcessStarter, PipeStreamFactory pipeStreamFactory, PipeToken pipeToken) in D:\Programmierung\CSharp\LegacyWrapper\LegacyWrapperClient\Transport\PipeConnector.cs:line 60 at DynamicInjectorf689774ad5234e388d4a1b8fc2720cdd(Object[] ) at Ninject.Activation.Context.ResolveInternal(Object scope) at Ninject.Activation.Context.Resolve() at Ninject.KernelBase.Resolve(IRequest request, Boolean handleMissingBindings) at Ninject.Planning.Targets.Target'1.ResolveWithin(IContext parent) at System.Linq.Enumerable.WhereSelectArrayIterator'2.MoveNext() at System.Linq.Buffer'1..ctor(IEnumerable'1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable'1 source) at Ninject.Activation.Providers.StandardProvider.Create(IContext context) at Ninject.Activation.Context.ResolveInternal(Object scope) at Ninject.Activation.Context.Resolve() at Ninject.KernelBase.Resolve(IRequest request, Boolean handleMissingBindings) at Ninject.Planning.Targets.Target'1.ResolveWithin(IContext parent) at System.Linq.Enumerable.WhereSelectArrayIterator'2.MoveNext() at System.Linq.Buffer'1..ctor(IEnumerable'1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable'1 source) at Ninject.Activation.Providers.StandardProvider.Create(IContext context) at Ninject.Activation.Context.ResolveInternal(Object scope) at Ninject.Activation.Context.Resolve() at Ninject.KernelBase.Resolve(IRequest request, Boolean handleMissingBindings) at Ninject.ResolutionExtensions.Get[T](IResolutionRoot root, IParameter[] parameters) at LegacyWrapperClient.Client.WrapperProxyFactory1.CreateProxy() in D:\Programmierung\CSharp\LegacyWrapper\LegacyWrapperClient\Client\WrapperProxyFactory.cs:line 43