Skip to content

System.Reflection.TargetInvocationException with class "System.Diagnostics.Process" in Net 6 #7

@gpablo1

Description

@gpablo1

When I use the "System.Diagnostics.process" class with the getStaticWrapper function with Net 4 everything works correctly. But when trying to do it with Net 6, an exception error occurs.

*** Code example with Net 4:
do (getenv("Userprofile") + "\kwruntime\kodnet\loader.prg")
_screen.kodnetLoader.Load("v4")
kodnet = _screen.kodnetLoader.v4.COM
m.processalive= m.kodnet.getStaticWrapper("System.Diagnostics.Process")
return
*** These lines work without error.

*** Code example with Net 6:
do (getenv("Userprofile") + "\kwruntime\kodnet\loader.prg")
_screen.kodnetLoader.Load("v6")
kodnet = _screen.kodnetLoader.v6.COM
m.processalive= m.kodnet.getStaticWrapper("System.Diagnostics.Process")
return
*** These same lines produce the next exception error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Exception: El tipo especificado no se encontró. Revise si debe cargar un ensamblado.
at FoxShell.Kodnet.GetTypeFromString(String typeName)
at FoxShell.Kodnet.GetStaticWrapper(String type)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at FoxShell.MethodDescriptor.Invoke(Object target, Object[] args, Type[] arguments)
at FoxShell.MethodDescriptor.__Invoker(Object target, Object[] args)
at FoxShell.DynamicValue.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] oargs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)

In Net's documentation, both for version 4 and version 6, the instructions use for the "System.diagnostics.process" class are exactly the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions