After upgrading Fax.NET project to .NET 4 Client Profile i got this Exception:
MissingMethodException:
Constructor on type 'Microsoft.Win32.SafeHandles.SafeRegistryHandle' not found.
Exception occurred on return statement of this function:
private static SafeHandle CreateRegistrySafeHandle(IntPtr handle)
{
Type type;
type = typeof(SafeHandle).Assembly.GetType("Microsoft.Win32.SafeHandles.SafeRegistryHandle");
return (SafeHandle)Activator.CreateInstance(
type,
BindingFlags.Instance | BindingFlags.NonPublic,
null,
new object[] { handle, true },
null);
}
What is solution for this exception?
The SafeRegistryHandle Constructor is public (BindingFlags.Public) since .NET 4, not internal or private (BindingFlags.NonPublic).
If you have access to the source code, you can replace the method with