Question

I'm running RAD Studio Delphi XE2. Something strange appears to have been done to one of my .pas files. Many of the lines from my unit1.pas have been replaced with simply 'º' and others are missing. I am left with a small section of code from somewhere in the middle of my original file. Can I get the original unit1.pas back by somehow decompiling unit1.dcu?

Also, why would this happen? Have you heard of this before? The code runs but, obviously, I can't edit anything I can't see.

Was it helpful?

Solution

Even if you could decompile it, it would likely be an unmaintainable mess compared to your original.

Instead, try looking in the __History folder for your project. You should find older versions of your code. Pick the newest one ;-)

why would this happen?

Any number of reasons. Bug in the IDE? Bug in an IDE plugin or a custom component? Bug in your code that overwrites a source file, maybe?

OTHER TIPS

You cannot decompile a .dcu file to the original source. Information is lost in the translation from source code to executable code. Type declarations, variable names, method names, code layout and so on are simply not present in the compiler's output. Compilation is a one way process.

If you use revision control, you'll just be able to pull the latest version from the repository. If you don't use revision control, you've just learnt a lesson the hard way and you will never again attempt to perform software development without revision control.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top