.NET DLL

Discussion forum about all things Team Developer 5.x and 6.x
satyavangala
United States of America
Posts: 37
Joined: 24 Sep 2017, 17:25
Location: Chantilly, virginia usa

.NET DLL

Post by satyavangala » 19 Dec 2013, 14:57

We are trying to call .NET DLL methods from a Gupta app built using 6.2 SP1 Win32 app. It is working on build machines. However, when we deploy at the client site, it is throwing o"Unable to locate by Object ID" errors. Since it is difficul to debug the entire app, we built a small test DLL using C# with a method to return current Window user ID. We generated APL and successfully used from a bGupta app built using 6.2 SP1 Win 32 on build machines.
When we tried to use the test DLL and app on the machines at client site, it also failed with the "Unable to locate by Object ID" message.
We have the following questions.

1) DLL was built with .net 4.0 as target and the DLL was invoked from a network drive. .NET security did not allow it. Where do we set "LoadFromRemoteSources" setting? According to Microsoft it should be added to the exe.config file. However, the exe is Gupta app. Please let us know. We cannot have the DLL on client machines.

2) What is the reason for "Unable to locate by Object ID" error? We verified that the machines used by our client got the same .NET installs as our build machines.

Please see the attached source and error message documents.

Appreciate your help in this matter.

Thanks,
Satya Vangala
You do not have the required permissions to view the files attached to this post.
Last edited by Anonymous on 19 Dec 2013, 15:04, edited 1 time in total.

satyavangala
United States of America
Posts: 37
Joined: 24 Sep 2017, 17:25
Location: Chantilly, virginia usa

Re: .NET DLL

Post by satyavangala » 19 Dec 2013, 17:59

Additional details to help resolve this issue.

1) DLL is successfully loaded
2) Object is successfully created

Added additional messages to confirm that. Both messages were displayed. Verified that the object ID is the same as the one reported in the next message.

Code: Select all

If ( GAIL_LoadCustomAssembly(appDir, m_AssemblyName ) )
	Call SalMessageBox('Loaded assembly', m_AssemblyName, MB_Ok)
	Call GAIL_CreateObject( m_ClassName, m_ObjectID, parameters )
	Call SalMessageBox('Created object', SalNumberToStrX(m_ObjectID,0), MB_Ok)

3) Fails to locate object ID when calling the method. Base error is reported and obviously additional message is also displayed.

Code: Select all

If GAIL_InvokeMethod_Overload1( objectID, methodName, payLoad, resultSize )
	Call SalSetBufferLength( result, resultSize )
	Call GAIL_GetResultPayload( result )
Else
	Call __Base_ReportError( methodName )
	Call SalMessageBox('Failed to invoke method-Overload1', methodName, MB_Ok)
Could anyone explain what causes it to not locate an object just created? Based on that we would like to make changes to .NET configuration etc.

Appreciate your help.

Thanks,
Satya Vangala

RainerE
Germany
Posts: 2245
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: .NET DLL

Post by RainerE » 07 Mar 2022, 12:59

Ok, the question was a long time ago.
But this is the only question regarding this topic and I run into a similar problem:

Our program uses a DLL implemented as .NET assembly.
Our program is installed on a network share.
If the program tries to use functions from within this DLL, we got the following error message:
Error ... (our own error message)
(Could not load file or assembly 'file:///n:\...\....dll (the name of our dll) or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Inner Exception:
An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.micorosoft.fwlink/?LinkId=155569 for more information.)
As described in the microsoft link https://docs.microsoft.com/en-us/previo ... (v=vs.100), I put the file SOffice.exe.config in the directory containing our application executable SOffic.exe. The contents of this file are

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
   <runtime>
      <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>
Now everything works as expected

Kind regards,
Rainer

Return to “General Discussion TD 5.x and 6.x”

Who is online

Users browsing this forum: [Ccbot] and 1 guest