Connecting to TFS Programmatically - Error: A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll - vb.net

I have the following code which used to work and now no longer works:
collectionUri = New Uri(txtServerName.Text)
Dim tpc As New TfsTeamProjectCollection(collectionUri)
workItemStore = tpc.GetService(Of WorkItemStore)()
teamProject = workItemStore.Projects(txtProjectName.Text)
When my application hits the line: workItemStore = tpc.GetService(Of WorkItemStore)() I get the following error:
ArgumentException occurred
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information:
Requested value 'Information' was not found.
{System.ArgumentException: Requested value 'Information' was not found. at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)}
I have uninstalled and re-installed Visual Studio 2013 ... same results. I have tried the application on another computer and it works just fine so I know my code is good.
I haven't touched this app in a few months so I'm not certain what would have changed. Any ideas?
Thanks.

Related

An unhandled exception occurred while processing the request SqlException

When I create a new project (web api) in Visual Studio 2019, I try running the project but I got the following error:
An unhandled exception occurred while processing the request.
SqlException: Invalid object name 'Books'.
Microsoft.Data.SqlClient.SqlCommand+<>c.b__169_0(Task result)
Did you check spelling in SqlDataReader? For me, I was misspelled. If the spelling is correct, any chance are you re-using the same name of an existing environmental variable for a different database on the same SQL Server? If the answer is yes it can be issue too.

F# SqlDataProvider, "The type initializer for 'Main' threw an exception.'

I have been attempting to use the SqlProvider type provider on several different databases where I work. In Visual Studio, intellisense for these different DBs (of types MS Access, SQL Server, and an ODBC connection) all work as shown below:
I've even tried it on the Northwind example database:
It does not matter the connection I actually choose, they seem to all result in 2 exceptions when the code is actually run:
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'Main' threw an exception.
Source=SqlProviderTest2
StackTrace:
at Main.main(String[] _arg1) in C:\Users\***\source\repos\SqlProviderTest2\Program.fs:line 29
Inner Exception 1:
TypeInitializationException: The type initializer for '<StartupCode$SqlProviderTest2>.$Main' threw an exception.
Inner Exception 2:
FileLoadException: Could not load file or assembly 'System.Data.OleDb, Version=4.0.1.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
How is it possible that the intellisense can detect the DB but not work when the program is actually run? Is there a common fix for this?
(Using Visual Studio 2019 Professional, if that makes a difference.)

TargetInvocationException Was Unhandled When Using fileWriter.Write()

I have a project in VB.NET that creates a byte array of an image input then creates a file of the image in .jpg format. Here is the code:
Dim fileWriter As New System.IO.FileStream(filePath,System.IO.FileMode.Create)
fileWriter.Write(imageBuf, 0, imageBuf.Length)
fileWriter.Close()
Once the code runs, I get the following error right after the second line executes:
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an invocation.
I did take a look at similar posts on this site, however none of them seems to be relevant to mine. I would appreciate your input.
Thank you.

An unhandled exception of type 'System.Data.DBConcurrencyException' occured

I'm doing a program using VB 2012 with microsoft access 2013 database in the middle of the coding I encountered this error "An unhandled exception of type 'System.Data.DBConcurrencyException' occured..."
Can anyone help me get through this error.
Thanks

DBNull error - 'System.InvalidCastException'

Using Visual Studio 2008 and generating .net 2.0 framework with VB.net for a web application.
I encountered a very strange problem currently. After I build a solution and click a link in a web page, I got an error message as following. The same thing happened when I tried to run in debug mode.
*************************************** ERROR Message ******************************************************
"An exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll but was not handled in user code"
"Additional information: Operator '=' is not defined for type 'DBNull' and string "". "
*******************************************************************************************************************
The problem part is simply as below in a vb file. The value of dataview(0)(“name”) is NULL and my_name is a variable string. The strange is thing I didn't change any code in this vb file. This vb file was built previously and used for a long time ago without any problem. It just suddenly happened today. I have this syntax all over the program without causing any problem. I have tried to restore the whole solution back to original but still have the problem.
Can anyone please advise why all the sudden and how to fix?
If dataview(0)(“name”) = my_name then …
Try to determine NULL value first ..
If NOT IsDBNull(dataview(0)(“name”)) Then
If dataview(0)(“name”) = my_name then
'codes here
End If
End If