Why would Visual Studio/CLR produce a “bad” executable?

This is a weird problem I have started having recently. My team is developing a COTS application and we have a few people with their hands in the code. A few weeks ago, I received an error message when trying to debug (and run the compiled EXE):

"Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item."

It ended up I had to refactor this snippet of code:

mcolSchedulesNeedingOverride(New Guid(lstrErrorParts(0))) &= vbNewLine & lstrErrorParts(2)

In to this:

Dim lguidKey As New Guid(lstrErrorParts(0))
Dim lstrErrorMsg As String = mcolSchedulesNeedingOverride(lguidKey)
lstrErrorMsg &= vbNewLine & lstrErrorParts(2)
mcolSchedulesNeedingOverride(lguidKey) = lstrErrorMsg

That then allowed VS to generate a EXE that actually worked. I really don't understand why, but it worked. I did use the peverify utility to determine which assembly was having an issue.

Now I have the same issue in a different code branch after about 25 files were updated yesterday. This is NOT going to be fun to track down - so I was hoping someone could offer some insight as to why this might be happening - and that might help me narrow down where to look.

peverify shows all our assemblies to be correct, but is spitting back 90+ errors for System.Windows.Forms.dll!

Anybody have any tips?

Answers


You say that you have several developers working on the project, so I wonder whether they experience this problem as well.

If it is only happening on your machine than I would not go searching for a problem inside the code (the refactoring that you did seems quite unrelated to the error so I guess the reason why it was working afterwards was another) but go looking for a problem in your environment.

Maybe something is broken or incorrectly configured with you .NET Framework installation. Can you see which file is throwing the error message? Any policy defined for any assembly on your machine?

Regards, divo


Need Your Help

Base Method Invocation on enum

java methods enums invoke

I'm learning about Java enums and I was wondering what is the best approach to check multiple enums for a matching value in order to call a specific method. I have defined two separate enums below ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.