I am gradually trying to debug a website created by a developer, who's left the company. I am re-creating the source code, as he does not seem to have checked it in when he left.
I'm using dotPeek, decompiling the bits I think are relevant, then pasting them in to the older code available locally. It seems like a mad thing to be doing, but I can't think of any other way of restoring the code to a state where my local matches the server, and thus could be debugged. (Which isn't working properly btw, a different issue.
Anyway, the code is littered with things like this:
source?.Remove(source.Last<HtmlNode>());
//(Gives error: Invalid Expression term ".") and
return !this.Request.IsAjaxRequest() ? (ActionResult)this.View(nameof(Upload)) : (ActionResult)this.PartialView("_Upload");
//(Gives error: The name nameof does not exist in the current context. and
auditRepository?.Save();
//(Gives error: Syntax Error ":" expected).
I understand this is because of a code library issue.
This is a Visual Studio 2010 Project. In the project properties it says "Target Framework": .NET Framework 4. Output type: Class Library
I'm not sure what to do too make it resolve the "new" code items. I tried: - Changing to a different Framework version (this gave many hundreds of errors). - Installing "roslyn" (or trying to) both by trying to use the Package Manager Console (I tried 3 different versions none worked); I've also tried installing it manually by copying the directory from the server.
I saw some suggestions online about adding things to the app.Config (that didn't work) or the web.Config (also didn't work).
Does anyone know how to make the errors go away? I really have to fix them, since I don't know if changing them (for example, by removing the ?) is actually causing other errors. I also tried installing someone's code to fix the nameof. That didn't work, either, possibly because no example was shown of how to call it.
But I kinda need it to work as coded - I'm already de-compiling it, I don't have time to re-write it in an older (or newer, who knows?) version..
Any ideas? I've run out...