madskristensen / WebEssentials2012

http://vswebessentials.com
Other
95 stars 46 forks source link

Multiple errors during builds and unit tests when using Bundling #52

Open SeanKilleen opened 10 years ago

SeanKilleen commented 10 years ago

I think the culprits involved are a combination of:

I'm not sure which is at fault, but this issue only came to light when switching to Web Essentials 2012 bundling.

Reproduction

This is difficult to produce. Sometimes it happens when building, other times when running unit tests.

I'll see literally 17 errors like the following:

image

(The files do exist, by the way, and other times the builds & test runs complete without this message showing.)

This error will repeat itself about 17 times for various files within the bundle, and will open each bundle file in the IDE multiple times as it brings up each error:

image

Some of the file names are repeated, which is strange because I do not repeat any files in my bundles.

Some Potential Clues

I'd appreciate any help to get the reproduction steps down better. This adds 17 clicks and 40+ seconds to every build or test run, so you can understand why I'm eager to figure it out. :)

SeanKilleen commented 10 years ago

And of course as soon as I post I get somewhere on it. :)

It seems that Web Essentials goes off of the directory structure and not the solution file when finding bundles to check.

As the result of a previous ugly merge, it appears that I had bundle files in an old location on disk but not in the solution, and these were being run as well. I noticed when one of the bundles that visual studio opened was slightly different.

Leaving this open as a suggestion to maybe search the solution file itself for bundles to process, instead of the directory.

SeanKilleen commented 10 years ago

Annnd there it goes again. I think I have more of a reproduction now.

Steps to (Usually) Reproduce

At this point, my expected behavior is that the bundle files and their outputs will be copied to the output directory. However, I think Web Essentials may already be expecting the source files before they've been copied to the output directory, causing it to error out.

In some cases, building multiple times will resolve the issue, since it will gradually accumulate the source files it needs.

In some cases, I can simply hit "Rebuild" once and the problem will be resolved.

Still working on pinning it down.

SeanKilleen commented 10 years ago

In narrowing down the Reproduction steps, I believe the issue is something that happens similar to the Feedback item here (which appears to be closed):

http://webessentials.uservoice.com/forums/140520-general/suggestions/3497348-building-a-solution-while-not-focused-on-a-web-pro

If I have the bundle file or another file from the web project open and on my screen when I build, there is no problem whatsoever.

If I have a file that is part of another project in the solution open and focused (most of my unit tests, etc.) and the project builds, I will likely see the error.

This seems like an issue since 90% of the time I'm building is using either ContinuousTests or ReSharper so that I can do some TDD.

Is there a way to isolate this or specify something specifically to see if this fixes it?

I'm going to attempt to hard-code the full path (C:\path\to\file) to see it makes a difference.

SeanKilleen commented 10 years ago

An update: Hard-coding the entire physical path, while not a solution for production scenarios, did indeed remove the message I was receiving upon build.