Dotfuscator Causes TFS Build to Hang - visual-studio-2012

I am having trouble getting builds to complete when they are set to run Dotfuscator on files. My environment is Visual Studio Professional 2012 paired with Team Foundation Server 2012, thus I am using Build Definitions and the Microsoft Team Foundation build architecture (build controller, build agents, etc).
My problem is that when I launch a build definition in Release config, which is set to run Dotfuscator Professional on my output files, the build hangs (either that or runs for so long that I have yet to see one complete). The log file shows that it is hanging during the build process template activity "Associate Changesets and Work Items", and task manager on my build server confirms that at this point Dotfuscator is running with huge CPU and memory requirements (around 50% CPU and I've seen near a gig of memory required). Here is the latter portion of the build log...
Find Property Values
CurrentLabel =
LastLabel =
Result = (Collection)
UpdateWorkItems = True
Final Property Values
Condition = True
Final Property Values
Condition = True
The last lines are duplicated on purpose, this is exactly what the log reads. This is where the build hangs and Dotfuscator is still running on the build server.
And here's the interesting part, when I do a local build on the build server (right click on solution, click rebuild) the build runs great, done in under a minute Dotfuscator and all. This suggests to me that something is going on between Dotfuscator and Team Foundation Build. Possibly something to do with the Build Process Template and/or Build Agents? I'm not much of an expert on Team Foundation Build other than the work I have done getting to this point.
Any ideas on what I can do to get Dotfuscator to run faster or correctly (depending on the cause of my error)? All help is much appreciated.

Related

Attaching MSVC 2012 profiler hangs the application

I have a C++ application (it's built using Qt 5.8 library and works with PostgreSQL 9.5 database in case it's relevant). The application is build by MSVC 2012 compiler, is 64-bit application and both debug and release versions run normally on their own and under cdb debugger.
When I try to profile the running application by Visual Studio instrument (Analyze -> Profiler -> Attach), it seemingly hangs as soon as it tries to do something meaningful: simply resizing a window or clicking on checkboxes works, but any attempt to compute new values and write them to database never succeeds, as if control flow didn't return from some call.
When I stop the profiling, Studio marks as a "hot path" sequence of calls RtlWalkFrameChain->RtlpWalkFrameChain->RtlpLookupFunctionEntryForStackWalks->RtlLookupFunctionTable->RtlAcquireSRWLockShared.
RtlpWalkFrameChain has the biggest "exclusive samples" count.
Trying to filter data to exclude initial several seconds of run (until the apparent freeze) results in "No Call Tree Data Is Available" message.
I didn't manage to find any article or post with a similar problem.
The project is build in Qt Creator (I don't have a project file Studio would understand, so I can't run "normal" performance analysis).
OS is Windows 7, exact version of Visual Studio is 11.0.61219.00 Update 5.
Any idea on the subject would be welcome.
Upd: When I try to profile the application with Luke Stackwalker profiler, it aborts with the message ERROR: StackWalk64-Endless-Callstack!. The only relevant comment about the message I found is this Stackoverflow question. When I run application under cdb debugger and then try to profile it with Luke Stackwalker, the error message is the same, but subsequent pause in the debugger shows the proper (or at least believable) stack for all threads. For the working thread debugger points to a line of code inside system library and doesn't advance no matter what I do (once again, without profiling attempts the application runs normally, debugger or not).

Prevent Code Analysis from testing Provider Hosted Apps

I am on a SharePoint project that has a dozen or so Provider Hosted Applications.
For those not familiar, PHA's are basically fancy MVC web apps but they have a secondary "special" project that gets added to the solution that contains an app manifest used by SharePoint (sort of reminiscent of old VDPROJ project types). This special project type is only used when packaging the application for consumption by SharePoint, it serves no other purpose and therefore has no need for generating output such as DLL's or EXE's (except for when creating a deployment package, but that is irrelevant to this conversation).
The problem I am having is Visual Studio fails when running Code Analysis on all the PHA's because the PHA's app project does not generate a DLL. The analysis isn't running and reporting errors, it has a hard failure because it is expecting the special app project to generate a DLL and that DLL is physically not found. This prevents Code Analysis from even getting to the point of checking if the checkbox for "Enable Code Analysis on Build" is checked or not (which it isn't in case you're wondering). The only thing I get is two error messages like this person on CodePlex was having:
CA0052 Error Running Code Analysis CA0052: No targets were selected. [Errors and Warnings] (Global)
CA0055 Error Running Code Analysis CA0055 : * Could not load file: 'bin\Debug\xxxxx.dll'. [Errors and Warnings] (Global)
I have even gone to the point of creating a brand new PHA project from scratch using the Visual Studio 2013 wizard leaving everything as default which should eliminate any potential for hard external references the existing projects might have. Even then I still run into the same problem. Every time Code Analysis is run Studio tries to test that special project and throws the hard failure.
The weird thing is Code Analysis is running on the TFS build agent without incident. This leads me to think that the issue is Studio related and specific to the version installed locally. However, I have tried this with VS2013 RTM, 2013 Update 5, and VS2015 Update 3 and they ALL behave the same. Create a new PHA, follow the prompts for local development using MVC, and then run Alt-F11 and the issue reproduces.
Can anyone get Code Analysis to work on a SharePoint PHA?

VS 2015 Publishing Issues

I can build and debug my project (Web Forms App / VS 2015) but when I attempt to publish I don't get any errors (in the standard errors panel) but in the output window I see I do and the publish fails, but the build runs !?!?!?!?
Each of the types do exist and the namespacing is correct, I have no idea why these issues are stopping me from publishing ?!?!?!?!
The issue fixed itself, I didn't do anything or make any significant changes.

Is a good practice to install Visual Studio in the same server as TFS?

We are having compilations problems in a TFS server and it's because the server lacks several libraries built in the default VS2012 Premium installation (Microsoft Fakes in this case).
I'm unsure of going ahead installing a full instance of VS, but first I want to know what is the best practice in this regard?
What is recommended?
Since we are talking a sandbox, do whatever and don't worry about it. If we are talking best practices, it's not a good idea to put your build tier on the app tier / data tier. Any developer could check in code that gets run on the server during the compile and trash your entire environment.
Have you looked at Visual Studio Online? It's a hosted TFS service and you can use their hosted build controller or configure your own. That makes for a very good sandbox IMO.
I don't see any issue installing VS on the TFS server(I assume you run your builds on that server too and that's when you are seeing the problem. Ideally tfs server and build box should be separate but some people use the same box.)
I have used Visual Studio on the build box several times to debug issues with builds. You just need to make sure you close the VS instance (if it has a solution open) once you are done with debugging otherwise your builds can fail when they try to clean up the project directory at the start of the build.
We run a single server TFS instance which has everything - sql, SharePoint and tfs - running on it. It is also a build server so it has to have VS 2010 and 2012 installed. We've done this with all versions since 2005 and have had no issues with it at all.

How to Troubleshoot Visual Studio 2012 Hangs/Lockups

I am doing PHP development in Visual Studio, and my solution contains projects for PHP, SSRS, and SQL Server (SSDT). And I am using TFS for version control. So there's a lot going on in my dev environment that can "go wrong".
I am experiencing intermittent hangs, usually around 5 minutes a clip. Visual Studio gives me the wait cursor, and if I click anywhere in VS the window dims. And then I just have to wait it out. Sometimes I can end the devenv.exe task, other times it takes several minutes to terminate the task. If I am feeling patient, I just wait and eventually (around 5 mins) VS comes back to life. I've never experienced loss of data, source control issues, etc, even when I terminate the process.
It happens sometimes when I save. Sometimes when I check-in. Sometimes when I check out. Sometimes when I build. I have been unable to discern any sort of pattern of the behavior.
All my workstation resources are fine- no RAM or i/o or network or CPU issues.
What can I do to troubleshoot this issue? Can I run VS in some sort of logging mode that would allow me to pinpoint what is taking so long during these periods of lockup?
To turn on logging in visual studio, run: devenv.exe /log
I personally would do this with a shortcut.
Consider deleting old TFS Workspace definitions left over from Continuous Integration Builds.
We had this same problem with a large Team Foundation Server project tree.
Sometimes, but not always, opening a Solution in Visual Studio 2010 or Visual Studio 2012 would hang exactly as described above. VS 2010 was most vulnerable; VS 2012 seemed less vulnerable, but it still would hang.
We were able to get some clues by monitoring the server activity on the TFS Server machine and the underlying SQL Server machine. A certain query stored procedure was using excessive CPU time in SQL Server. We tracked this stored procedure name to a TFS operation involved in scanning TFS Workspace definitions for other user's checkouts for files.
Our TFS environment has been in use for over 3 years, and we have been using Continuous Integration build definitions using a "zombie army" of developer workstations as TFS Build Agent hosts. We also create new TFS Branches for major releases. Each branch contains about 20 separate Visual Studio Solutions with their own build definitions.
Over time, we had accumulated about 2,000 TFS Workspace definitions on each developer workstation. We had about 10 workstations at one time with their own definitions.
Using the Visual Studio Command window and running as a TFS Administrator, we used this command to identify all workspaces created by our "build user":
tf workspaces /collection:tfservername\collectionname /owner:ourbuilduser >c:\tf_ws_del.bat
We then used global substitutes and the Notepad++ editor macro recorder to convert each result line into this form:
tf workspace /delete /collection:tfservername\collectionname workspacename;ourbuilduser <c:\yes.txt
where C:\yes.txt contained a single line of "y"
We also used some human judgement to remove deletion lines for workspaces named for our most recent TFS branch.
We then ran that c:\tfs_ws_del.bat script in the same Visual Studio Command window and waited patiently for it to finish.
End Result: Our Visual Studio solutions open very quickly. Even browsing the folder hierarchy in Source Control Explorer has sped up considerably.
WARNING: The deletion operations for a very large number of workspaces may expand the TempDB on the underlying SQL Server by a large amount. Coordinate with your DBA's to monitor space on the SQL Server machine. Stopping and restarting the TFS Collection via the graphical TFS Administrator Console tool helps reclaim some of that TempDB space and return it to its internal "free block" list.
This can also seem to happen when the symbol servers specified in your debug options are down or unreachable... it will not actually hang in this case but seem to as it times out for each file access.
To temporarily get around this problem uncheck the symbol servers that are down.

Resources