1

There are 2 relevant questions on this site on this issue, none of them seems to go to any detail or provide any solution that has proven helpful. They are:

I am not sure what type of project this is, I believe it is a either ASP WebForms or ASP WebSite. Some more illuminated individual here may ask the correct question to figure that out, I would appreciate that.

Regardless, this issue has been happening on and off and we're never quite sure what causes it exactly nor what we've done to fix in the past. What I am sure is that I've way to many hours doing nothing but staring at this cryptic output to no avail.

Every time, the story is something like:

  • Everything fine, compiling, all working ?great? (sort of, its an old project...).
  • Do some changes; that works as expected.
  • Do some change; that results in this error. (sometimes some git operation is involved, and this is a big suspect for me.)
  • Retry compile. (Let us say, it works 9 out of 10)
  • But then comes that 10th time, and no luck.
  • Do ??? and it starts working (mostly restore a hard backup of the machine's project folder, done daily)

This is frustrating and counter-productive. We're never quite sure what we did that caused it or what fixed it.

Any help would be very much appreciated. Here is a screenshot of the error in Visual Studio 2019.

error-image

wazz
  • 4,953
  • 5
  • 20
  • 34
Pedro Rodrigues
  • 2,520
  • 2
  • 27
  • 26
  • Not 100% sure, but I would start by setting AutoEventWireup to true. I think it connects the code file to the page automatically. – wazz Aug 22 '20 at 20:48
  • Just read up some more and this might not help, but give it a try. See the 2nd and 3rd(!) answers [here](https://stackoverflow.com/questions/680878/what-does-autoeventwireup-page-property-mean). – wazz Aug 22 '20 at 20:54
  • @wazz makes no difference. – Pedro Rodrigues Aug 24 '20 at 08:18
  • @wazz didn't realize you authored both comments. I've read that answers, but no luck. I tried autoWire both true and false, and also remved all of `Handles` in code behind files, all four combinations of those. Can you elaborate on how you manage to relate that to the error? I'm failing to see any connection between the two. – Pedro Rodrigues Aug 24 '20 at 08:27
  • 1
    @wazz My best guest is that some weird dependency is missing. Since no change has been committed to git, and this happens regardless, this is definitly an issue on this machine in particular (not on others necessarly). So it is something that is not in git (which `aspx` and `vb` files are). Add to that the fact that this is a not a well maitained project that had previously been under a single soul responsability. – Pedro Rodrigues Aug 24 '20 at 08:31

1 Answers1

0

Figured it.

So the real question here is, should the Web.config file be added to version control?

Yes

Of course. The project will not compile without the correct Web.config file.

No

The Web.config file is for environment configuration (you know, environment variables are so outdated.). You should never place things like database credentials in source control.

ASP

So the answer, in ASP, is yes and no. For the reasons above. If this is not crazy, I'm crazy.

It turns out, the Web.config file had been tampered with. I had;

<system.web>
    <compilation explicit="false" strict="false" targetFramework="4.5.2" debug="true">
    (...)
</system.web>

Where it should have been:

<system.web>
    <compilation explicit="false" strict="false" targetFramework="4.7.2" debug="true">
    (...)
</system.web>

Can you spot the difference? Its not easy, in fact not even Visual Studio was able to understand, or tell me, what was wrong. But that little pesky 4.5.2 should have been 4.7.2. Its not like we changed it. It had been like that for a while before this non sense.

What a cryptic framework.

Pedro Rodrigues
  • 2,520
  • 2
  • 27
  • 26