Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8015261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:12:18+00:00 2026-06-04T20:12:18+00:00

I got an DLL registered on my local system. (Which I didn’t own) When

  • 0

I got an DLL registered on my local system. (Which I didn’t own)

When I create the COM object using VBScript and calling the function everything works fine:

set Elo = CreateObject("jniwrapper.elocomserver")
Elo.refreshIntray()

But when using C#.net I get an NotImplementedException:

A NotImplementedException got thrown!

Type javaClientComServerType = Type.GetTypeFromProgID("jniwrapper.elocomserver");
dynamic eloJavaClient = Activator.CreateInstance(javaClientComServerType);

eloJavaClient.refreshIntray();

Any idea whats going on here and how to fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:12:19+00:00Added an answer on June 4, 2026 at 8:12 pm

    This seems to be an issue related with .NET COM interop through DLR (dynamic language runtime) in association with the COM bridge that the COM-Server (Java program wrapped through JNI utilizes). I suspect the latter to be ComfyJ from Teamdev. You can work around the issue by providing an implementation of IDynamicMetaObjectProvider and DynamicMetaObject. For a start see the code below:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Dynamic;
    using System.IO;
    using System.Linq.Expressions;
    using System.Reflection;
    using System.Runtime.InteropServices;
    using Microsoft.Win32;
    using System.Diagnostics;
    
    class DynamicCOMObject : IDynamicMetaObjectProvider, IDisposable 
    {
        private Type m_comType = null;
        private object m_comHolder = null;
    
        public DynamicCOMObject(string progId)
        {        
            m_comType = Type.GetTypeFromProgID(progId);
            m_comHolder = Activator.CreateInstance(m_comType);
        }
    
        public void Dispose()
        {
            if (m_comHolder != null)
            {
                Marshal.ReleaseComObject(m_comHolder);
                m_comHolder = null;
            }
        }
    
        #region IDynamicMetaObjectProvider Members
        DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(
            System.Linq.Expressions.Expression parameter)
        {
            return new DynamicCOMObjectMetaObject(parameter, this);
        }
        #endregion
    
        private class DynamicCOMObjectMetaObject : DynamicMetaObject
        {
            internal DynamicCOMObjectMetaObject(
                System.Linq.Expressions.Expression parameter,
                DynamicCOMObject value)
                : base(parameter, BindingRestrictions.Empty, value)
            {
            }
    
            public override DynamicMetaObject BindSetMember(SetMemberBinder binder,
                DynamicMetaObject value)
            {
                // Method to call in the containing class:
                string methodName = "SetValue";
    
                // setup the binding restrictions.
                BindingRestrictions restrictions =
                    BindingRestrictions.GetTypeRestriction(Expression, LimitType);
    
                // setup the parameters:
                Expression[] args = new Expression[2];
                // First parameter is the name of the property to Set
                args[0] = Expression.Constant(binder.Name);
                // Second parameter is the value
                args[1] = Expression.Convert(value.Expression, typeof(object));
    
                // Setup the 'this' reference
                Expression self = Expression.Convert(Expression, LimitType);
    
                // Setup the method call expression
                Expression methodCall = Expression.Call(self,
                        typeof(DynamicCOMObject).GetMethod(methodName),
                        args);
    
                // Create a meta object to invoke Set later:
                DynamicMetaObject setDictionaryEntry = new DynamicMetaObject(
                    methodCall,
                    restrictions);
                // return that dynamic object
                return setDictionaryEntry;
            }
    
            public override DynamicMetaObject BindGetMember(GetMemberBinder binder)
            {
                // Method call in the containing class:
                string methodName = "GetValue";
    
                // One parameter
                Expression[] parameters = new Expression[]
                {                
                    Expression.Constant(binder.Name)
                };
    
                DynamicMetaObject getDictionaryEntry = new DynamicMetaObject(
                    Expression.Call(
                        Expression.Convert(Expression, LimitType),
                        typeof(DynamicCOMObject).GetMethod(methodName),
                        parameters),
                    BindingRestrictions.GetTypeRestriction(Expression, LimitType));
                return getDictionaryEntry;
            }
    
            public override DynamicMetaObject BindInvokeMember(
                InvokeMemberBinder binder, DynamicMetaObject[] args)
            {
                Expression[] parameters = new Expression[2];
                Expression[] subs = new Expression[args.Length];
    
                parameters[0] = Expression.Constant(binder.Name);
    
                for (int i = 0; i < args.Length; i++)
                    subs[i] = args[i].Expression;
    
                parameters[1] = Expression.NewArrayInit(typeof(object), subs);
    
                DynamicMetaObject methodInfo = new DynamicMetaObject(
                    Expression.Call(
                    Expression.Convert(Expression, LimitType),
                    typeof(DynamicCOMObject).GetMethod("CallMethod"),
                    parameters),
                    BindingRestrictions.GetTypeRestriction(Expression, LimitType));
                return methodInfo;
            }
        }
    
        public object SetValue(string key, object value)
        {
            return m_comType.InvokeMember(key,
                BindingFlags.Instance | BindingFlags.SetProperty | BindingFlags.Public,
                null,
                m_comHolder,
                new object[] { value });   
        }
    
        public object GetValue(string key)
        {
            return m_comType.InvokeMember(key,
                BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.Public,
                null,
                m_comHolder,
                null);          
        }
    
        public object CallMethod(string methodName, params object[] parameters)
        {
            return m_comType.InvokeMember(methodName,
                BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public,
                null,
                m_comHolder,
                parameters);        
        }
    }
    

    Usage:

            using (dynamic client = new DynamicCOMObject("jniwrapper.elocomserver"))
            {                
                client.refreshIntray();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Com Component DLL which i register in SysWOW64 using Regsvr32.exe I
I've got WCF service which contains List with data from LibW.dll(my dll). In main
I implemented a python com server and generate an executable and dll using py2exe
I got a DLL generated on VC6 and using wstring , and I'm trying
I've got a dll, into which I've inserted txt files into the names subdirectory
I've got an Outlook VBA script which calls on a custom dll to perform
I've got a c# assembly which I'm invoking via COM from a Delphi (win32
I developed a ClassLibrary in VC++ using VS 2005. Later I registered the dll,
I'm new to COM programming. I've got a COM object (and associated IClassFactory) all
I've got a DLL that is written in C++ and I want to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.