Exception thrown by type initializer for 'Microsoft.TeamFoundation.Framework.Server.ByteArray'

arrays, checkin, exception

Solution

I was encountering the same issue just today. For the sake of others that may hit this page, since it's the first hit when googling the exception. I looked at the MS Social question here, but the key appears to be something in the App Tier Framework, I executed IISRESET.exe (as Administrator) on the TFS app tier server and everything started working perfectly again.

Problem

Please anyone has an idea what is causing this error while checking in files on tfs: "The type initializer for 'Microsoft.TeamFoundation.Framework.Server.ByteArray' threw an exception." this is the stack trace from the event Viewer: ``` **TF53010: The following error has occurred in a Team Foundation component or extension: Date (UTC): 4/7/2014 5:57:14 AM Machine: TFSSRV Application Domain: /LM/W3SVC/8080/ROOT/tfs-14-130413234339367965 Assembly: Microsoft.TeamFoundation.Framework.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727 Service Host: 61e34d8a-3995-492a-b0b1-b1ca43304366 (SABIS) Process Details: Process Name: w3wp Process Id: 3896 Thread Id: 4844 Account name: INTEREDLB\eghanem Detailed Message: TF30065: An unhandled exception occurred. Web Request Details Url: tfssrv:8080/tfs/_tfs_resources/VersionControl/v1.0/upload.ashx [method: POST] User Agent: Team Foundation (devenv.exe, 10.0.30319.1) Headers: Content-Length=125836&Content-Type=multipart%2fform-data%3b+boundary%3d--------------------------8e5m2D6l5Q4h6&Accept-Language=en-US&Authorization=NTLM+TlRMTVNTUAADAAAAGAAYAIQAAABcAVwBnAAAABIAEgBYAAAADgAOAGoAAAAMAAwAeAAAAAAAAAD4AQAABYKIogYC8CMAAAAPEamXFnqofvmag9Tv7MumY0kATgBUAEUAUgBFAEQATABCAGUAZwBoAGEAbgBlAG0ASQBUAFEAQwAwADIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgPJ7o8t9UpE1fWPVvOiQkwEBAAAAAAAAOSm6OSZSzwGLmc3OzEbnlAAAAAACABIASQBOAFQARQBSAEUARABMAEIAAQAMAFQARgBTAFMAUgBWAAQAJgBpAG4AdABlAHIAZQBkAGwAYgAuAHMAYQBiAGkAcwAuAG4AZQB0AAMANAB0AGYAcwBzAHIAdgAuAGkAbgB0AGUAcgBlAGQAbABiAC4AcwBhAGIAaQBzAC4AbgBlAHQABQASAHMAYQBiAGkAcwAuAG4AZQB0AAgAMAAwAAAAAAAAAAEAAAAAIAAAPo4lTXR7%2fzg5WQsBAME%2f5oXFLmv2XYbJUNBj1fLeBfkKABAAAAAAAAAAAAAAAAAAAAAAAAkAPgBIAFQAVABQAC8AdABmAHMAcwByAHYALgBpAG4AdABlAHIAZQBkAGwAYgAuAHMAYQBiAGkAcwAuAG4AZQB0AAAAAAAAAAAA&Expect=100-continue&Host=tfssrv%3a8080&User-Agent=Team+Foundation+(devenv.exe%2c+10.0.30319.1)&X-TFS-Version=1.0.0.0&X-TFS-Session=f705371b-1a30-4e4a-861c-62d652add5e3&TF-Instance=f705371b-1a30-4e4a-861c-62d652add5e3 Path: /tfs/_tfs_resources/VersionControl/v1.0/upload.ashx Local Request: False Host Address: 192.168.200.234 User: INTEREDLB\eghanem [authentication type: NTLM] Exception Message: The type initializer for 'Microsoft.TeamFoundation.Framework.Server.ByteArray' threw an exception. (type TypeInitializationException) Exception Stack Trace: at Microsoft.TeamFoundation.Framework.Server.ByteArray..ctor(Int32 sizeRequested) at Microsoft.TeamFoundation.VersionControl.Server.UploadHandler.UploadFile(VersionControlRequestContext versionControlRequestContext, String workspaceName, String workspaceOwner, String serverItem, Byte[] hash, Stream fileStream, Int64 fileLength, Int64 compressedLength, Int64 offsetFrom, CompressionType compressionType) at Microsoft.TeamFoundation.VersionControl.Server.TeamFoundationVersionControlService.UploadFile(TeamFoundationRequestContext requestContext, String workspaceName, String workspaceOwner, String serverItem, Byte[] hash, Stream fileStream, Int64 fileLength, Int64 compressedLength, Int64 offsetFrom, CompressionType compressionType) at Microsoft.TeamFoundation.VersionControl.Server.UploadHandler.Execute() Inner Exception Details: Exception Message: Exception of type 'System.OutOfMemoryException' was thrown. (type OutOfMemoryException) Exception Stack Trace: at Microsoft.TeamFoundation.Framework.Server.BufferPool..ctor(Int32 bufferSize, Int32 initialNumberOfEntries) at Microsoft.TeamFoundation.Framework.Server.ByteArray..cctor() For more information, see Help and Support Center at** ```

Original source