kandi background
Explore Kits

mutandis | JavaScript Mutation Testing | Code Analyzer library

 by   saltlab Java Version: Current License: No License

 by   saltlab Java Version: Current License: No License

Download this library from

kandi X-RAY | mutandis Summary

mutandis is a Java library typically used in Code Quality, Code Analyzer applications. mutandis has no bugs, it has no vulnerabilities, it has build file available and it has low support. You can download it from GitHub.
Mutandis is a JavaScript mutation testing tool that leverages static and dynamic program analysis to guide the mutation generation process towards parts of the code that are error-prone or likely to influence the program’s output.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • mutandis has a low active ecosystem.
  • It has 52 star(s) with 4 fork(s). There are 25 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 2 open issues and 1 have been closed. On average issues are closed in 56 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of mutandis is current.
mutandis Support
Best in #Code Analyzer
Average in #Code Analyzer
mutandis Support
Best in #Code Analyzer
Average in #Code Analyzer

quality kandi Quality

  • mutandis has 0 bugs and 0 code smells.
mutandis Quality
Best in #Code Analyzer
Average in #Code Analyzer
mutandis Quality
Best in #Code Analyzer
Average in #Code Analyzer

securitySecurity

  • mutandis has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • mutandis code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
mutandis Security
Best in #Code Analyzer
Average in #Code Analyzer
mutandis Security
Best in #Code Analyzer
Average in #Code Analyzer

license License

  • mutandis does not have a standard license declared.
  • Check the repository for any license declaration and review the terms closely.
  • Without a license, all rights are reserved, and you cannot use the library in your applications.
mutandis License
Best in #Code Analyzer
Average in #Code Analyzer
mutandis License
Best in #Code Analyzer
Average in #Code Analyzer

buildReuse

  • mutandis releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • mutandis saves you 3570 person hours of effort in developing the same functionality from scratch.
  • It has 7636 lines of code, 448 functions and 46 files.
  • It has high code complexity. Code complexity directly impacts maintainability of the code.
mutandis Reuse
Best in #Code Analyzer
Average in #Code Analyzer
mutandis Reuse
Best in #Code Analyzer
Average in #Code Analyzer
Top functions reviewed by kandi - BETA

kandi has reviewed mutandis and discovered the below as its top functions. This is intended to give you an instant insight into mutandis implemented functionality, and help decide if they suit your requirements.

  • Implements the filtering of a function .
    • Creates JS format line from expression .
      • modify js code
        • Returns the statements that should be mutated in the given list of statements .
          • Start statistical analysis .
            • Analyses a variable for the given function .
              • Recursive method to search for names in the given node .
                • create a crawler
                  • Compute the function rank map .
                    • Get joint variable list .

                      Get all kandi verified functions for this library.

                      Get all kandi verified functions for this library.

                      mutandis Key Features

                      JavaScript Mutation Testing

                      Event handling at calling a third party 32-bit dll from a 64-bit c# WinForms application

                      copy iconCopydownload iconDownload
                      namespace NetComClassLibrary3
                      {
                          // technically, we don't *have to* define an interface, we could do everything using dynamic stuff
                          // but it's more practical so we can reference this .NET dll from our client
                          [ComVisible(true)]
                          [Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                      
                          // same remark than above.
                          // This *must* match the OnMyEvent signature below
                          [ComVisible(true)]
                          [Guid("31dd1263-0003-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                      
                          // this "event" interface is mandatory
                          // note from the .NET perspective, no one seems to implement it
                          // but it's referenced with the ComSourceInterfaces attribute on our COM server (below)
                          [ComVisible(true)]
                          [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
                          [Guid("31dd1263-0000-4071-aa4a-d226a55116bd")]
                          public interface IMyEvents
                          {
                              // dispids are mandatory here otherwise you'll get a DISP_E_UNKNOWNNAME error
                              [DispId(1)]
                              void OnMyEvent(string text);
                          }
                      
                          [ComVisible(true)]
                          [ComSourceInterfaces(typeof(IMyEvents))]
                          [Guid("31dd1263-0001-4071-aa4a-d226a55116bd")]
                          public class MyClass : IMyClass
                          {
                              public event OnMyEventDelegate OnMyEvent;
                      
                              public object MyMethod()
                              {
                                  // we use the current running process to test out stuff
                                  // this should be Windows' default surrogate: dllhost.exe
                                  var process = Process.GetCurrentProcess();
                                  var text = "MyMethod. Bitness: " + IntPtr.Size + " Pid: " + process.Id + " Name: " + process.ProcessName;
                                  Console.WriteLine(text); // should not be displayed when running under dllhost
                                  OnMyEvent?.Invoke("MyEvent. " + text);
                                  return text;
                              }
                          }
                      }
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      using System;
                      using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      namespace NetComClassLibrary3
                      {
                          // technically, we don't *have to* define an interface, we could do everything using dynamic stuff
                          // but it's more practical so we can reference this .NET dll from our client
                          [ComVisible(true)]
                          [Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                      
                          // same remark than above.
                          // This *must* match the OnMyEvent signature below
                          [ComVisible(true)]
                          [Guid("31dd1263-0003-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                      
                          // this "event" interface is mandatory
                          // note from the .NET perspective, no one seems to implement it
                          // but it's referenced with the ComSourceInterfaces attribute on our COM server (below)
                          [ComVisible(true)]
                          [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
                          [Guid("31dd1263-0000-4071-aa4a-d226a55116bd")]
                          public interface IMyEvents
                          {
                              // dispids are mandatory here otherwise you'll get a DISP_E_UNKNOWNNAME error
                              [DispId(1)]
                              void OnMyEvent(string text);
                          }
                      
                          [ComVisible(true)]
                          [ComSourceInterfaces(typeof(IMyEvents))]
                          [Guid("31dd1263-0001-4071-aa4a-d226a55116bd")]
                          public class MyClass : IMyClass
                          {
                              public event OnMyEventDelegate OnMyEvent;
                      
                              public object MyMethod()
                              {
                                  // we use the current running process to test out stuff
                                  // this should be Windows' default surrogate: dllhost.exe
                                  var process = Process.GetCurrentProcess();
                                  var text = "MyMethod. Bitness: " + IntPtr.Size + " Pid: " + process.Id + " Name: " + process.ProcessName;
                                  Console.WriteLine(text); // should not be displayed when running under dllhost
                                  OnMyEvent?.Invoke("MyEvent. " + text);
                                  return text;
                              }
                          }
                      }
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      using System;
                      using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      namespace NetComClassLibrary3
                      {
                          // technically, we don't *have to* define an interface, we could do everything using dynamic stuff
                          // but it's more practical so we can reference this .NET dll from our client
                          [ComVisible(true)]
                          [Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                      
                          // same remark than above.
                          // This *must* match the OnMyEvent signature below
                          [ComVisible(true)]
                          [Guid("31dd1263-0003-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                      
                          // this "event" interface is mandatory
                          // note from the .NET perspective, no one seems to implement it
                          // but it's referenced with the ComSourceInterfaces attribute on our COM server (below)
                          [ComVisible(true)]
                          [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
                          [Guid("31dd1263-0000-4071-aa4a-d226a55116bd")]
                          public interface IMyEvents
                          {
                              // dispids are mandatory here otherwise you'll get a DISP_E_UNKNOWNNAME error
                              [DispId(1)]
                              void OnMyEvent(string text);
                          }
                      
                          [ComVisible(true)]
                          [ComSourceInterfaces(typeof(IMyEvents))]
                          [Guid("31dd1263-0001-4071-aa4a-d226a55116bd")]
                          public class MyClass : IMyClass
                          {
                              public event OnMyEventDelegate OnMyEvent;
                      
                              public object MyMethod()
                              {
                                  // we use the current running process to test out stuff
                                  // this should be Windows' default surrogate: dllhost.exe
                                  var process = Process.GetCurrentProcess();
                                  var text = "MyMethod. Bitness: " + IntPtr.Size + " Pid: " + process.Id + " Name: " + process.ProcessName;
                                  Console.WriteLine(text); // should not be displayed when running under dllhost
                                  OnMyEvent?.Invoke("MyEvent. " + text);
                                  return text;
                              }
                          }
                      }
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      using System;
                      using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      namespace NetComClassLibrary3
                      {
                          // technically, we don't *have to* define an interface, we could do everything using dynamic stuff
                          // but it's more practical so we can reference this .NET dll from our client
                          [ComVisible(true)]
                          [Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                      
                          // same remark than above.
                          // This *must* match the OnMyEvent signature below
                          [ComVisible(true)]
                          [Guid("31dd1263-0003-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                      
                          // this "event" interface is mandatory
                          // note from the .NET perspective, no one seems to implement it
                          // but it's referenced with the ComSourceInterfaces attribute on our COM server (below)
                          [ComVisible(true)]
                          [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
                          [Guid("31dd1263-0000-4071-aa4a-d226a55116bd")]
                          public interface IMyEvents
                          {
                              // dispids are mandatory here otherwise you'll get a DISP_E_UNKNOWNNAME error
                              [DispId(1)]
                              void OnMyEvent(string text);
                          }
                      
                          [ComVisible(true)]
                          [ComSourceInterfaces(typeof(IMyEvents))]
                          [Guid("31dd1263-0001-4071-aa4a-d226a55116bd")]
                          public class MyClass : IMyClass
                          {
                              public event OnMyEventDelegate OnMyEvent;
                      
                              public object MyMethod()
                              {
                                  // we use the current running process to test out stuff
                                  // this should be Windows' default surrogate: dllhost.exe
                                  var process = Process.GetCurrentProcess();
                                  var text = "MyMethod. Bitness: " + IntPtr.Size + " Pid: " + process.Id + " Name: " + process.ProcessName;
                                  Console.WriteLine(text); // should not be displayed when running under dllhost
                                  OnMyEvent?.Invoke("MyEvent. " + text);
                                  return text;
                              }
                          }
                      }
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      using System;
                      using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      namespace NetComClassLibrary3
                      {
                          // technically, we don't *have to* define an interface, we could do everything using dynamic stuff
                          // but it's more practical so we can reference this .NET dll from our client
                          [ComVisible(true)]
                          [Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                      
                          // same remark than above.
                          // This *must* match the OnMyEvent signature below
                          [ComVisible(true)]
                          [Guid("31dd1263-0003-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                      
                          // this "event" interface is mandatory
                          // note from the .NET perspective, no one seems to implement it
                          // but it's referenced with the ComSourceInterfaces attribute on our COM server (below)
                          [ComVisible(true)]
                          [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
                          [Guid("31dd1263-0000-4071-aa4a-d226a55116bd")]
                          public interface IMyEvents
                          {
                              // dispids are mandatory here otherwise you'll get a DISP_E_UNKNOWNNAME error
                              [DispId(1)]
                              void OnMyEvent(string text);
                          }
                      
                          [ComVisible(true)]
                          [ComSourceInterfaces(typeof(IMyEvents))]
                          [Guid("31dd1263-0001-4071-aa4a-d226a55116bd")]
                          public class MyClass : IMyClass
                          {
                              public event OnMyEventDelegate OnMyEvent;
                      
                              public object MyMethod()
                              {
                                  // we use the current running process to test out stuff
                                  // this should be Windows' default surrogate: dllhost.exe
                                  var process = Process.GetCurrentProcess();
                                  var text = "MyMethod. Bitness: " + IntPtr.Size + " Pid: " + process.Id + " Name: " + process.ProcessName;
                                  Console.WriteLine(text); // should not be displayed when running under dllhost
                                  OnMyEvent?.Invoke("MyEvent. " + text);
                                  return text;
                              }
                          }
                      }
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      using System;
                      using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      
                      %windir%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      %windir%\Microsoft.NET\Framework\v4.0.30319\regasm.exe NetComClassLibrary3.dll /codebase /tlb
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_CLASSES_ROOT\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_CLASSES_ROOT\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      Windows Registry Editor Version 5.00
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\AppID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "DllSurrogate"=""
                      
                      [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{31dd1263-0001-4071-aa4a-d226a55116bd}]
                      "AppID"="{31dd1263-0001-4071-aa4a-d226a55116bd}"
                      
                      var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                      
                      var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                      
                      using System;
                      // removed by mma - using NetComClassLibrary3; // we can reference the .net dll as is
                      
                      namespace ConsoleApp10
                      {
                          // inserted by mma:
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public interface IMyClass
                          {
                              event OnMyEventDelegate OnMyEvent;
                              object MyMethod();
                          }
                          [System.Runtime.InteropServices.Guid("31dd1263-0002-4071-aa4a-d226a55116bd")]
                          public delegate void OnMyEventDelegate(string text);
                          // end of insertion
                      
                          class Program
                          {
                              static void Main(string[] args)
                              {
                                  Console.WriteLine("Bitness: " + IntPtr.Size);
                                  // note we don't use new MyClass() otherwise we may go inprocess
                                  // removed by mma var type = Type.GetTypeFromCLSID(typeof(MyClass).GUID);
                                  // inserted by mma:
                                  var type = Type.GetTypeFromProgID("NetComClassLibrary3.MyClass");
                                  // end of insertion
                                  var obj = (IMyClass)Activator.CreateInstance(type);
                      
                                  // note I'm using the beloved dynamic keyword here. for some reason obj.OnMyEvent works but locally raises a cast error I've not investigated further...
                                  dynamic d = obj;
                                  d.OnMyEvent += (OnMyEventDelegate)((t) =>
                                  {
                                      Console.WriteLine(t);
                                  });
                                  Console.WriteLine(obj.MyMethod());
                              }
                          }
                      }
                      
                      Bitness: 4 // running as 32-bit
                      MyEvent. MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      MyMethod. Bitness: 8 Pid: 23780 Name: dllhost // from 64-bit world
                      
                      Bitness: 8 // running as 64-bit
                      MyEvent. MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      MyMethod. Bitness: 4 Pid: 56140 Name: dllhost // from 32-bit world
                      

                      How to add html i tag to sub-strings that matched the elements of the array if they don't already have the tag

                      copy iconCopydownload iconDownload
                      De minimis non curat lex
                      
                      <i><i>De minimis</i> non curat lex<i>
                      
                      <?php
                      
                      function itilizedWords($subjects){
                      
                        $arrayToSearch = array("Prima facie", "De facto", "Vis-à-vis", "De future",
                            "De future", "De integro", "De integro", "De jure", 
                            "Inter alia", "De novo", "Viz", "De minimis", "Res gestae",
                           "De minimis non curat lex", "Res Gestae Divi Augusti", "et seq.",
                           "et seq.", "Ex facie ", "A priori ", "A priori", "A posteriori",
                           "Ex gratia", "A quo ", "Ex officio", "Ab extra", "Ab extra", "Ab 
                            initio",
                           "Ex post facto", "Absque hoc", "Factum", "Actori incumbit probation", 
                           "Habeas corpus", 
                            "Actus reus",  "Functus officio", "Ad coelom ", "Ad coelom ", "Ad 
                            colligenda bona", 
                            "Idem ", "Ad hoc", "In absentia", "Ad hominem", "In curia", "Ad idem", 
                        "In extenso", 
                           "Ad infinitum", "In futuro", "Ad litem", "In haec verba", "Ad quod damnum", "In limine",
                            "Ad valorem","Pari material", "Adjournment sine die", "Adjournment sine die",
                            "Amicus curiae", "Amicus curiae", "Animus nocendi", "Inter se", "Animus revertendi",
                            "Intra vires", "Arguendo", "Arguendo", "Audi alteram partem", "Ipso facto", "Bona fide",
                            "Jus cogens", "Mala fide", "Locus standi", "Certiorari", "Mandamus","Contra proferentem",
                            "Contra proferentem","Coram non judice","Modus operandi",
                            "Cuius est solum eius est usque ad coelum et ad inferos","Nemo judex in sua causa",
                            "Status quo ante","Nisi","Stare decisis","Non est factum","Per se ","Per se ","Res gestae ",
                            "Uberrima fides","Vice versa","Mutatis Mutandis","Wednesbury");
                      
                           $matchedwords=array();
                          $offset = 0;
                           $allpos = array();
                          $pos=0;
                          foreach ($arrayToSearch as $value) {
                            while(($pos = strpos($subjects, $value, $offset))!== false){
                              $pos2=strpos($subjects, "<i>$value</i>", $offset) ;
                              $offset   = $pos + 1;
                                if ($pos2==$pos-3){
                                     // $value is yet between tags
                                     $offset   = $pos + 5;
                                    continue;
                                }
                              $prev=substr($subjects,0,$pos);
                              $next=substr($subjects,$pos+strlen($value));  
                      
                             $subjects = $prev . '<i>'. $value.'</i>'.  $next;
                             $offset +=7;
                      
                            }
                          }
                          return $subjects;
                      
                             }
                      
                             $subjects ="This is the Prima facie tried to do this it's been ....Prima facie <p><i>Prima facie</i></P> Prima facie  <p>Status quo ante  Uberrima fides</P> <i>Uberrima fides</i> <p>Mutatis Mutandis Wednesbury</p> <p><i>In futuro</i></p>";
                      
                               echo htmlentities(itilizedWords($subjects));
                      ?>
                      
                      De minimis non curat lex
                      
                      <i><i>De minimis</i> non curat lex<i>
                      
                      <?php
                      
                      function itilizedWords($subjects){
                      
                        $arrayToSearch = array("Prima facie", "De facto", "Vis-à-vis", "De future",
                            "De future", "De integro", "De integro", "De jure", 
                            "Inter alia", "De novo", "Viz", "De minimis", "Res gestae",
                           "De minimis non curat lex", "Res Gestae Divi Augusti", "et seq.",
                           "et seq.", "Ex facie ", "A priori ", "A priori", "A posteriori",
                           "Ex gratia", "A quo ", "Ex officio", "Ab extra", "Ab extra", "Ab 
                            initio",
                           "Ex post facto", "Absque hoc", "Factum", "Actori incumbit probation", 
                           "Habeas corpus", 
                            "Actus reus",  "Functus officio", "Ad coelom ", "Ad coelom ", "Ad 
                            colligenda bona", 
                            "Idem ", "Ad hoc", "In absentia", "Ad hominem", "In curia", "Ad idem", 
                        "In extenso", 
                           "Ad infinitum", "In futuro", "Ad litem", "In haec verba", "Ad quod damnum", "In limine",
                            "Ad valorem","Pari material", "Adjournment sine die", "Adjournment sine die",
                            "Amicus curiae", "Amicus curiae", "Animus nocendi", "Inter se", "Animus revertendi",
                            "Intra vires", "Arguendo", "Arguendo", "Audi alteram partem", "Ipso facto", "Bona fide",
                            "Jus cogens", "Mala fide", "Locus standi", "Certiorari", "Mandamus","Contra proferentem",
                            "Contra proferentem","Coram non judice","Modus operandi",
                            "Cuius est solum eius est usque ad coelum et ad inferos","Nemo judex in sua causa",
                            "Status quo ante","Nisi","Stare decisis","Non est factum","Per se ","Per se ","Res gestae ",
                            "Uberrima fides","Vice versa","Mutatis Mutandis","Wednesbury");
                      
                           $matchedwords=array();
                          $offset = 0;
                           $allpos = array();
                          $pos=0;
                          foreach ($arrayToSearch as $value) {
                            while(($pos = strpos($subjects, $value, $offset))!== false){
                              $pos2=strpos($subjects, "<i>$value</i>", $offset) ;
                              $offset   = $pos + 1;
                                if ($pos2==$pos-3){
                                     // $value is yet between tags
                                     $offset   = $pos + 5;
                                    continue;
                                }
                              $prev=substr($subjects,0,$pos);
                              $next=substr($subjects,$pos+strlen($value));  
                      
                             $subjects = $prev . '<i>'. $value.'</i>'.  $next;
                             $offset +=7;
                      
                            }
                          }
                          return $subjects;
                      
                             }
                      
                             $subjects ="This is the Prima facie tried to do this it's been ....Prima facie <p><i>Prima facie</i></P> Prima facie  <p>Status quo ante  Uberrima fides</P> <i>Uberrima fides</i> <p>Mutatis Mutandis Wednesbury</p> <p><i>In futuro</i></p>";
                      
                               echo htmlentities(itilizedWords($subjects));
                      ?>
                      
                      De minimis non curat lex
                      
                      <i><i>De minimis</i> non curat lex<i>
                      
                      <?php
                      
                      function itilizedWords($subjects){
                      
                        $arrayToSearch = array("Prima facie", "De facto", "Vis-à-vis", "De future",
                            "De future", "De integro", "De integro", "De jure", 
                            "Inter alia", "De novo", "Viz", "De minimis", "Res gestae",
                           "De minimis non curat lex", "Res Gestae Divi Augusti", "et seq.",
                           "et seq.", "Ex facie ", "A priori ", "A priori", "A posteriori",
                           "Ex gratia", "A quo ", "Ex officio", "Ab extra", "Ab extra", "Ab 
                            initio",
                           "Ex post facto", "Absque hoc", "Factum", "Actori incumbit probation", 
                           "Habeas corpus", 
                            "Actus reus",  "Functus officio", "Ad coelom ", "Ad coelom ", "Ad 
                            colligenda bona", 
                            "Idem ", "Ad hoc", "In absentia", "Ad hominem", "In curia", "Ad idem", 
                        "In extenso", 
                           "Ad infinitum", "In futuro", "Ad litem", "In haec verba", "Ad quod damnum", "In limine",
                            "Ad valorem","Pari material", "Adjournment sine die", "Adjournment sine die",
                            "Amicus curiae", "Amicus curiae", "Animus nocendi", "Inter se", "Animus revertendi",
                            "Intra vires", "Arguendo", "Arguendo", "Audi alteram partem", "Ipso facto", "Bona fide",
                            "Jus cogens", "Mala fide", "Locus standi", "Certiorari", "Mandamus","Contra proferentem",
                            "Contra proferentem","Coram non judice","Modus operandi",
                            "Cuius est solum eius est usque ad coelum et ad inferos","Nemo judex in sua causa",
                            "Status quo ante","Nisi","Stare decisis","Non est factum","Per se ","Per se ","Res gestae ",
                            "Uberrima fides","Vice versa","Mutatis Mutandis","Wednesbury");
                      
                           $matchedwords=array();
                          $offset = 0;
                           $allpos = array();
                          $pos=0;
                          foreach ($arrayToSearch as $value) {
                            while(($pos = strpos($subjects, $value, $offset))!== false){
                              $pos2=strpos($subjects, "<i>$value</i>", $offset) ;
                              $offset   = $pos + 1;
                                if ($pos2==$pos-3){
                                     // $value is yet between tags
                                     $offset   = $pos + 5;
                                    continue;
                                }
                              $prev=substr($subjects,0,$pos);
                              $next=substr($subjects,$pos+strlen($value));  
                      
                             $subjects = $prev . '<i>'. $value.'</i>'.  $next;
                             $offset +=7;
                      
                            }
                          }
                          return $subjects;
                      
                             }
                      
                             $subjects ="This is the Prima facie tried to do this it's been ....Prima facie <p><i>Prima facie</i></P> Prima facie  <p>Status quo ante  Uberrima fides</P> <i>Uberrima fides</i> <p>Mutatis Mutandis Wednesbury</p> <p><i>In futuro</i></p>";
                      
                               echo htmlentities(itilizedWords($subjects));
                      ?>
                      
                      <?php
                      
                      function itilizedWords( $subjects, $arrayToSearch ){
                      
                          foreach( $arrayToSearch as $chars )
                          {
                              $regex = '|(?!<i>)(' . $chars . ')(?!</i>)|';
                      
                              if( preg_match( $regex, $subjects, $matches) )
                                  $subjects = preg_replace( $regex, '<i>' . $matches[0] . '</i>', $subjects );
                          }
                      
                          return $subjects;
                      }
                      
                      $arrayToSearch = [
                          "Prima facie", "De facto", "Vis-à-vis", "De future",
                          "De future", "De integro", "De integro", "De jure", "Inter alia", "De novo", 
                          "Viz", "De minimis", "Res gestae","De minimis non curat lex", 
                          "Res Gestae Divi Augusti", "et seq.","et seq.", "Ex facie ", "A priori ", 
                          "A priori", "A posteriori","Ex gratia", "A quo ", "Ex officio", "Ab extra", 
                          "Ab extra", "Ab initio","Ex post facto", "Absque hoc", "Factum", 
                          "Actori incumbit probation", "Habeas corpus", "Actus reus",  "Functus officio", 
                          "Ad coelom ", "Ad coelom ", "Ad colligenda bona", "Idem ", "Ad hoc", "In absentia", 
                          "Ad hominem", "In curia", "Ad idem", "In extenso", "Ad infinitum", "In futuro", 
                          "Ad litem", "In haec verba", "Ad quod damnum", "In limine","Ad valorem",
                          "Pari material", "Adjournment sine die", "Adjournment sine die","Amicus curiae", 
                          "Amicus curiae", "Animus nocendi", "Inter se", "Animus revertendi","Intra vires", 
                          "Arguendo", "Arguendo", "Audi alteram partem", "Ipso facto", "Bona fide",
                          "Jus cogens", "Mala fide", "Locus standi", "Certiorari", "Mandamus",
                          "Contra proferentem","Contra proferentem","Coram non judice","Modus operandi",
                          "Cuius est solum eius est usque ad coelum et ad inferos","Nemo judex in sua causa",
                          "Status quo ante","Nisi","Stare decisis","Non est factum","Per se ","Per se ",
                          "Res gestae ","Uberrima fides","Vice versa","Mutatis Mutandis","Wednesbury"
                      ];
                      
                      $subjects ="This is the Prima facie tried to do this it's been ....Prima facie <p><i>Prima facie</i></P> Prima facie  <p>Status quo ante  Uberrima fides</P> <i>Uberrima fides</i> <p>Mutatis Mutandis Wednesbury</p> <p><i>In futuro</i></p>";
                      
                      echo htmlentities( itilizedWords( $subjects, $arrayToSearch ) );
                      

                      How can I count across several relationships in django

                      copy iconCopydownload iconDownload
                      Team.objects.get( # the expected result is a team
                          pk=list( # filter out yourteams
                              filter(lambda x: x not in [ y.id for y in yourteams ],
                                  list( 
                                      Match.objects # search matches
                                      .filter(matchteams__in=yourteams) # in which you were involved
                                      .filter(matchteams__winner=False) # that you loose
                                      .annotate(cnt=Count('teams')) # and count them
                                      .order_by('-cnt') # sort appropriately
                                      .values_list('teams__id', flat=True) # finally get only pks
                                  )
                              )
                          )[0] # take the first item that should be the super winner
                      )
                      
                      matches_won_aginst_my_team = MatchTeam.objects.filter(team=my_team, winner=False).select_related(matches)    
                      teams_won_matches_aginst_my_team = matches_won_aginst_my_team.filter(winner=True).values_list('matchteams__team')
                      

                      Community Discussions

                      Trending Discussions on mutandis
                      • Key wrapping with an ECDH public key?
                      • Event handling at calling a third party 32-bit dll from a 64-bit c# WinForms application
                      • How to add html i tag to sub-strings that matched the elements of the array if they don't already have the tag
                      • How can I obtain consistently high throughput in this loop?
                      • How can I count across several relationships in django
                      Trending Discussions on mutandis

                      QUESTION

                      Key wrapping with an ECDH public key?

                      Asked 2019-Oct-08 at 05:36

                      Preface: I don't know whether it's more appropriate to ask this question here or on the Crypto site. Feel free to move or delete or whatever the appropriate SE action is.


                      I've been asked to help update some encryption software. Broadly speaking, the software already does the following steps, none of which are particularly unusual. I've left out the error handling and Provider arguments for simplicity of posting:

                      1) Generates a random symmetric secret key for use with AES-128 (or AES-256, mutatis mutandis):

                      KeyGenerator keygen = KeyGenerator.getInstance("AES");
                      keygen.init (128, a_SecureRandom_instance);
                      SecretKey sessionKey = keygen.generateKey();
                      

                      2) Wraps the symmetric secret key, depending on whether the user is using...
                      2a) ...an RSA public key from a keypair:

                      // OAEP wasn't used in this software for hysterical raisins
                      Cipher wrapper = Cipher.getInstance("RSA/ECB/PKCS1Padding");
                      wrapper.init (Cipher.WRAP_MODE, user_RSA_PublicKey);
                      

                      2b) ...a passphrase:

                      SecretKey stretched = ...passphrase stretched through a PBKDF like bcrypt...;
                      // I don't remember whether it's specified as "AES" or "AESWrap" here
                      Cipher wrapper = Cipher.getInstance("AES or AESWrap/ECB/NoPadding");
                      wrapper.init (Cipher.WRAP_MODE, stretched);
                      

                      2c) Either route, the session key is wrapped:

                      byte[] wrapped = wrapper.wrap(sessionKey);
                      

                      3) The session key is used to create a Cipher using Cipher.ENCRYPT_MODE along with a random IV, and then shedloads of data are run through it. That part is pretty standard but I can post it if you really want to see CipherInputStream usage. The wrapped session key is stored along with the encrypted data and a bunch of HMACs of everything under the sun.

                      Later at decryption time, the user provides either the RSA private key, or the passphrase for stretching; the software unwraps the symmetric key and decrypts the data.

                      All of that has been working for some time. But of course RSA keypairs are getting big and slow, so they'd like to support an additional possibility for step #2 above, in which the public keys are generated using an elliptic curve algorithm (P384 ECDH is the usual case). And this is where we're getting confused.

                      There doesn't seem to be a JCE replacement algorithm/transformation for elliptic curves in the Cipher wrapper = Cipher.getInstance("RSA/ECB/PKCS1Padding") invocation. The only one listed in the Java documentation is "ECIES", which seems(?) to be aimed more towards multiple party key agreement?

                      All of the APIs that I can find for the Java builtin JCE, or even looking over Bouncy Castle, only mention ECDH keys in the context of key agreement and transport, where they're used to generate a symmetric secret key instead of wrapping an existing one.

                      I feel we're missing something here, possibly because of poor assumptions. Is Cipher.wrap() genuinely not an option with ECDH keys? Or it is, but we need to do something funky in order to create the ECIES Cipher instance?

                      ANSWER

                      Answered 2019-Oct-08 at 05:36

                      RSA is an algorithm (or depending on how you look at it, two very similar but distinct algorithms) for encryption and signature. RSA encryption can encrypt dat which is a (lower-level) key, in which case it is called wrapping.

                      DH is a key agreement algorithm, in both its classical (aka integer, Zp, modp, or finite-field/FF) form and its elliptic-curve form (ECDH). Note that at least for classic DH the raw agreement value g^a^b mod n = g^b^a mod n has enough mathematical structure people aren't comfortable using it directly as a key, so we run it through a key derivation function, abbreviated KDF. It's not clear to me that ECDH values really need KDF, at least for the commonly used X9/NIST curves including P384 (you might look or ask on crypto.SX if you care), but using a KDF is cheap and well-established so we do so.

                      I've never heard anyone competent call (EC)DH key transport, because it is specifically NOT. It is included in key exchange, a term created to cover the (useful) union of transport and agreement.

                      You can create an encryption scheme using (EC)DH by using the agreed (and derived) value as the key for symmetric encryption -- and that is (EC)IES. I don't know what made you think IES is something else. Modern practice is that the symmetric encryption should be authenticated, and the standardized forms of IES as a separate scheme use CBC encryption with HMAC authentication, although you could validly design a scheme that uses e.g. GCM instead.

                      As you saw, the BouncyCastle provider provides implementations of DH (classic) or EC IES "with{AES,DESEDE}-CBC" (in versions before 1.56 the -CBC was sometimes omitted) which use KDF2 from P1363a with SHA1, the indicated CBC cipher, and HMAC-SHA1. The 'standard' (Sun/Oracle/Open) providers do not, but you can combine the raw agreement operation, the KDF, plus symmetric encryption and MAC to produce the same result.

                      This is similar (though different in some details) to the operation of CMS-formerly-PKCS7 with classic DH and ECDH and PGP with ECDH. (PGP does not support classic DH; it used ElGamal encryption instead as the alternative to RSA.) Not to mention TLS (sometimes through 1.2, always in 1.3) and SSH which use either classic or EC DH 'exchange' (here interactive, and usually ephemeral-ephemeral instead of having at least the receiver static) to produce a secret which is derived and used as key material for symmetric encryption with authentication of the data.

                      Source https://stackoverflow.com/questions/58276562

                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                      Vulnerabilities

                      No vulnerabilities reported

                      Install mutandis

                      You can download it from GitHub.
                      You can use mutandis like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the mutandis component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

                      Support

                      For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

                      DOWNLOAD this Library from

                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      Explore Related Topics

                      Share this Page

                      share link
                      Reuse Code Quality Kits
                      Consider Popular Code Analyzer Libraries
                      Try Top Libraries by saltlab
                      Compare Code Analyzer Libraries with Highest Support
                      Compare Code Analyzer Libraries with Highest Quality
                      Compare Code Analyzer Libraries with Highest Security
                      Compare Code Analyzer Libraries with Permissive License
                      Compare Code Analyzer Libraries with Highest Reuse
                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      • © 2022 Open Weaver Inc.