Search code examples
c#debuggingexedotpeek

FileNotFoundException during runtime (ref to .exe file for debugging)


I've been trying to reference to custom .exe file to debug it.

  • related .pdb file was generated with ildasm, ilasm utilities
  • reference to executable file was added

,but in then end when debug was started i came across with issue:

enter image description here

I read that such behavior possible when some reference can't be resolved, but actually the *.exe file doesn't contains any specific refs (dotPeek screenshot):

enter image description here

I've encountered a lot at first sight similar questions at stackoverflow, but couldn't fined suitable for my situation

Q: Can anyone propose solution for the issue?


Solution

  • The assembly name is different from the file name (Assembly name is CrackMe, file name is TaskApp.exe). By renaming the file to CrackMe.exe, I'm able to reference it without errors.

    To be honest, I don't know why it's a problem at all. I'm fairly certain that I've renamed assemblies in the past without any issue. I'll probably try to dig further in the coming days.

    For future reference, I was able to find the issue by using fuslog (https://learn.microsoft.com/en-us/dotnet/framework/tools/fuslogvw-exe-assembly-binding-log-viewer). With the fusion log enabled, you can clearly see that it's trying to load CrackMe.exe, even when you reference TaskApp.exe.