TFS 2013 Throws Lib2GitSharp Error During Build/Deploy (Intermittent) - c#

For a while now, I have been having an issue with Team Foundation Server build/deploy process throwing the following error intermittently:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at LibGit2Sharp.Core.NativeMethods.git_threads_init()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
at LibGit2Sharp.Core.NativeMethods..cctor()
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.NativeMethods.RemoveHandle()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()
Exception Message: MSBuild error 255 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
This problem is very intermittent and it can be bypassed by simply retrying the build. Has anyone else run into this? Any solutions?

I know it is a little bit late for answer but it might help someone else
answer by Buck Hodges
We have now gotten to the bottom of this issue after debugging it with Manoj and customer support. It affected gated checkin of continuous delivery of Azure deployments as part of the build process when using the Azure SDK 2.5 or older. The workaround is to add /p:GenerateBuildInfoConfigFile=false to the msbuild arguments in your build definition. We are working on updating the build VM in production, but that will take 24-48 hours to propagate to all build pools.
You might want to read more in context here
https://social.msdn.microsoft.com/Forums/en-US/5a0d1950-1367-41a6-9171-676a0d0e93c1/tfs-online-getted-checkin-build-failures-vs-online-tfs-online-team-need-to-look-into-it?forum=TFService
Alternative solution based on comments
If you have VS installed on your build server, make sure you have opened it and licensed it. by #Phill

Strangely enough for me, I was getting the same error in the build logs:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\BuildInfo\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.targets (147): The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
I was able to simply RETRY the build, and it did not fail on the second try. So for me it was a transitory build issue.

Although late to the party, experienced this error recently and while the solution marked as the answer worked for that build, the error was fixed (and the switch removed) when Visual Studio 2012 was upgraded to Visual Studio 2015 Update 3 on the build server which was running TFS 2015 Update 3.

I hit this after I had upgraded my TFS 2013 XAML build machine to TFS 2015.
I had also changed the user that TFS 2015 XAML build used to run the build (service.
The Fix:
I had to log into the TFS 2015 XAML build machine as that new user and launch VS (I was using VS2013).
It ran through it's first time launch questions and setup.
I still saw the Lib2GitSharp Error issue sometimes after that.
Then I also logged VS (on the TFS 2015 XAML build machine) into a valid VS account.
I have not seen the Lib2GitSharp Error since and I never used the /p:GenerateBuildInfoConfigFile=false option.

I resolved this error by adding the build account to the local administrators group on the build machine.

Related

'Oracle.DataAccess.Client.OracleConnection' threw an exception, WinForms Application

I have a WinForms application in a .NET Framework 4.5.2 and an Oracle 10g database. This application works perfectly fine when I debug it using VS 2017, but when I deploy it as a ClickOnce application [using ClickOnce Deployment Manifest] it does not work and I keep getting the following error.
Image of the error upon connecting
relevant error text follows:
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleCommand' threw an exception. ---> Oracle.DataAccess.Client.OracleException: The provider is not compatible with the version of Oracle client
at Oracle.DataAccess.Client.OracleInit.Initialize()
at Oracle.DataAccess.Client.OracleCommand..cctor()
--- End of inner exception stack trace ---
It also runs perfectly fine when running the it from bin/Release folder, how can I make so that my deployed application runs like my local .exe in my repo.
And an additional piece of info, this WPF application is just a menu so that it runs my other WinForms applications, they work perfectly fine even when published, I have ensured that all applications are targeting an (x86) architecture and that all the ClickOnce settings are the same, to no avail.
Or can I even recreate the error when debugging so that I can fix? I tried forcing 64 - bit mode
(since that is what my machine is) in the properties of the project, but it does not even load. In the ClickOnce application it loads to the log-in page, but messes up when establishing a connection after the user has entered their credentials.
This is my first post so please fell free to request any more info and let me know if I have been unclear in anyway.
Thank you for the help in advance !
The issue has been resolved, but if anyone else come across it here is the solution, you have to find and add the appropriate DLL's manually into your project. I guess as mentioned in other answers, when the error says "...Client is not compatible..." it can also mean that the appropriate files do not exist.

Weird error: Microsoft (R) Visual C# Compiler version 3.5.0-dev-20359-01 (8da8ba0c)

I have a Unity 2020.3.22f1 project that was perfectly working at first. However, this error occured after editing and saving one of my scripts in Visual Studio (with no apparent bug in it):
I don't give details about my script or the project, because it doesn't seem to relate to the project itself or what I did, as the error appears now in all my Unity projects! I first tried to delete the script that triggered the bug, then I deleted the whole project. I even uninstalled/reinstalled Unity (different versions), Visual Studio and Unity Hub. But it seems that now I'm stuck with this forever.
Does anyone have a single clue about this? I saw one or two people having the same problem on the web, and with no other solution than formatting the hard drive. As I'm not working on my personal computer, I can't do that...I mean, there must be a rational explanation to this bug!!
I downloaded the latest version of Unity (2021.2.2f1), launched a brand new project, and the error now turned to: "The specified path can't be found" (rough translation from french), without more precision...still no idea what it means.
Ok, I found a solution from here: Unity 2019.3.0a7: Microsoft Visual C# Compiler Errors
I don't know how it's related, but it is suggested that the error can be triggered by uninstalling Anaconda and Python (which I happened to do recently), which leads to remaining artifacts in the Windows registry. I then deleted the following item in the Windows registry:
Computer\HKEY_CURRENT_USER\Software\Microsoft\Command
Processor\AutoRun
and restarted Unity. Now it works!
Got the same issue, the problem is in an incomplete path
Command line is : "C:\Program Files\Unity\Hub\Editor\2022.1.0a13\Editor\Data\Tools\netcorerun\netcorerun.exe" "C:/Program Files/Unity/Hub/Editor/2022.1.0a13/Editor/Data/Tools/ScriptUpdater/ApiUpdater.MovedFromExtractor.exe" "Library\Bee\artifacts\mvdfrm\UnityEngine.LocalizationModule.dll_9374ECE80455BEFE.mvfrm" "C:\Program Files\Unity\Hub\Editor\2022.1.0a13\Editor\Data\Managed\UnityEngine\UnityEngine.LocalizationModule.dll"
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\damos\project name is missing here\Library\Bee\artifacts\mvdfrm\UnityEngine.LocalizationModule.dll_9374ECE80455BEFE.mvfrm'.
This path is missing the project name between damos ans library

Dynamics CRM 2011 SyncWorkflowExecutionPlugin unable to find assembly

A strange error suddenly cropped up on our Dynamics CRM 2011 server - a specific plugin assembly can not be found when the plugin execution is triggered through a workflow process, with the error:
[Microsoft.Crm.ObjectModel: Microsoft.Crm.ObjectModel.SyncWorkflowExecutionPlugin]
[324f29aa-6082-ea11-80ee-005056837add: ]
Starting sync workflow 'workflow name', Id: 2d4f29aa-6082-ea11-80ee-005056837add
Sync workflow 'workflow name' terminated with error 'The type initializer for '<Module>' threw an exception.'
And exception stack trace ultimately leads to:
Inner Exception: <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
at <CrtImplementationDetails>.ThrowModuleLoadException(String errorMessage, Exception innerException)
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
at .cctor()
Inner Exception: System.Runtime.Serialization.SerializationException: Unable to find assembly 'AssemblyName, Version=8.75.0.267, Culture=neutral, PublicKeyToken=4e4051c21cef725b'.
The assembly is present on the server, version, culture, and public key token all match. Oddly enough the plugin steps work fine when the execution is triggered directly through a create/update/etc request - it's only when the execution is triggered through a workflow that the error occurs. And by triggered through a workflow I don't mean running code activity from that assembly, I mean a situation like:
Entity is created
OnCreate plugin from Assembly1 runs without issues
Workflow runs that updates a related entity, triggering OnUpdate plugin from Assembly1 - ERROR
This issue cropped up initially after a server restart. Another restart fixed it temporarily, until two days later it started happening again. We've tried everything we can think of - updating the assembly, unregistering/re-registering it, restarting all services, restarting the server again. Does anyone have any idea what might be the cause of this and how to fix it?
We discovered the issue was caused by a Windows update that had been applied before the initial restart, which had installed .NET framework v4.8 on the server. Although the application was still using an older version, apparently just having v4.8 installed was enough to cause errors. Reverting back to an earlier .NET version fixed the problem.
I am not certain what is the exact technical reason for this - seems to be something related to App Domains (https://learn.microsoft.com/en-us/dotnet/api/system.appdomain?view=netframework-4.8). But if you encounter a similar issue, check your .NET framework version.

Running CodedUI Test From Another Application

I'm planning to run my coded UI test from another project (in same solution). I added a reference of the CUIT project to my winform app project. Also I added these references as well
Microsoft.VisualStudio.TestTools.UITesting.dll
Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll
Microsoft.VisualStudio.TestTools.UITest.CodeGeneration.dll
Microsoft.VisualStudio.TestTools.UITest.Framework.dll
Microsoft.VisualStudio.TestTools.UITest.Playback.dll
My code is something like this
Playback.Initialize();
TestProject.CodedUITest1 coded = new TestProject.CodedUITest1();
coded.CodedUITestMethod1();
Playback.Cleanup();
However, I get an exception on the Playback.Initialize() call.
this is the message...
"An unhandled exception of type 'Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException' occurred in Microsoft.VisualStudio.TestTools.UITesting.dll"
Someone said that installing Test agent 2010/Test agent10 can solve this error.
I installed MS Visual studio Test Agent 2010, but same error happens.
What am I doing wrong here?
Thanks
I tried to run the test the same way you do and it worked for me.
Below are the reference dlls I have added in my projects
Please make sure you have added all the dlls. In case you are not able to find the dlls, look for them in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies.
If this doesn't work please provide the details of inner exception.
I found an answer to my problem. I found that the message of the inner exception is
"Retrieving the COM class factory for component with CLSID {27876903-E697-4406-BF49-1B8B92CB8735} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
After digging around I found that I have a 32 bit third party dll which I'm running on my 64-bit machine. The conflict is 64 bit process trying to invoke 32 bit process in 64 bit machine.
The solution is to change the project properties to target to 'X86' machine instead of 'Any'.

Unable to write manifest, System.OutOfMemoryException

When I try to compile my program on Visual Studio 2010 I get this error:
"Unable to write manifest
'obj\x86\Debug\WindowsApplication3.exe.manifest'. Exception of type
'System.OutOfMemoryException' was thrown."
It seems that this error occurs quite randomly. I got it for the first time some weeks ago and I had to restore Windows to solve the problem. Then I got the same error this morning and this time I had to delete the Debug folder. Finally, two hours later, same error again and none of the two previous solutions are working.

Categories