1
Answer

Net Reactor

I'm using Net Reactor v 6.9.0 to obfuscate a project created in Visual Studio 2019, a Windows Service, but when the service.exe is obfuscated and I try to install it I get the following error.

 system.reflection.targetinvocationexception exception has been thrown by the target of an invocation

If the service is not obfuscate it works fine.

I'm obfuscanting the service in mode "Windows Service" and "Aplication".

Any ideas.

Thanks

Answers (1)
0
Jayraj Chhaya

Jayraj Chhaya

314 6k 93.4k Dec 12

Hi Jorge Carlos Iglesias Alvarez,

The System.Reflection.TargetInvocationException typically indicates that an error occurred during the execution of a method invoked via reflection. In the context of obfuscation with Net Reactor, this can often be attributed to the obfuscation process altering method names or types that are expected by the Windows Service infrastructure.

Here are a few steps to troubleshoot and resolve the issue:

  1. Check Obfuscation Settings: Ensure that you are using the correct obfuscation settings for a Windows Service. The "Windows Service" mode should be appropriate, but double-check if any specific options might be causing issues.

  2. Exclude Critical Assemblies: If your service relies on certain assemblies (like configuration files or external libraries), consider excluding them from obfuscation. You can do this by adding them to the exclusion list in Net Reactor.

  3. Review Logs: Enable detailed logging in your service to capture any exceptions or errors that occur during startup. This can provide more insight into what might be failing.

  4. Test Incrementally: Try obfuscating only parts of your service incrementally to identify which specific part is causing the issue. This can help isolate the problem.

  5. Consult Documentation: Review the Net Reactor documentation for any known issues or specific configurations related to Windows Services.