Questions tagged [invalidoperationexception]

The exception that is thrown when a method call is invalid for the object's current state.

The exception that is thrown when a method call is invalid for the object's current state.

More information is available on Docs.

505 questions
0
votes
2 answers

C# Login Form InvalidOperationException

I have 3 type of account: Administrator, Staff and Student. When I login the Administrator user the code is okey, then the problem occur when I try to login Student user and Staff user.…
Jeff
  • 29
  • 3
  • 9
0
votes
1 answer

SqlDataAdapter.Update(DataTable) gives InvalidOperationException

I have this piece of code which should be pretty straight forward. private void btnSave_Click(object sender, EventArgs e) { try { using (SqlConnection sqlConn = new SqlConnection(connString)) { …
Nicholas Magnussen
  • 769
  • 2
  • 9
  • 26
0
votes
1 answer

Does Not Contain A Constructor That Takes 1 Arguments

I am a bit new to C# and I recently ran into an issue receiving an "Invalid Operation Exception" when my serial connection is lost during a serial communication operation. I am trying to catch the error via private void port_ErrorReceived (see…
Nevets
  • 305
  • 2
  • 5
  • 16
0
votes
1 answer

Cross-thread operation not valid in static method

I have the following code in my WinForms C# app:- private static void displayTime(object source, ElapsedEventArgs e) { timer++; timeTxtBox.Text = parseTime(timer); } This is throwing an InvalidOperationException with the message, with the…
0
votes
0 answers

Change Culture language for a web reference

I'm programming a new MVC 4 application. This must publish some data from the backoffice of the company. For now I'm only working local so this well make it easier, I tought. This is the situation: My computer has a dutch language pack. What means I…
0
votes
1 answer

Application crashes after Application_DispatcherUnhandledException handler called

On launching my WPF application, I try to see if a particular required exe is running or not. If that is not running, I throw InvalidOperationException like this if (gaInterface.ConnectToGA() != 0) throw new…
WAQ
  • 2,556
  • 6
  • 45
  • 86
0
votes
1 answer

Adding Row Error

I'm having trouble adding a row to my datagridview for a redo button. I want to add the public string variable called DeletedFilmName to a new row in the first column (column is called "Films"), that's it. I've tried all sorts of things but can't…
0
votes
1 answer

Change WebRequest's Method property (C#)

Is there a better way for changing the Method property of WebRequests after uploading a file than mine? My way looks like this: WebRequest request = WebRequest.Create("ftp://.../...txt"); request.Credentials = new NetworkCredential("...",…
Cubi73
  • 1,891
  • 3
  • 31
  • 52
0
votes
0 answers

Serial Port Disconnect with exception: system.invalidoperationexception in system.dll

My application is handling communication via serial ports. The problem of mine is that it has some chance that the the communication cable is unplugged from the computer. I use USB to Serial cables, which means if they unplug from the computer the…
Daniel
  • 383
  • 1
  • 5
  • 20
0
votes
1 answer

"This collection is read-only" exception when programmatically building project

I'm running some unit tests in parallel. Each unit test invokes some code that triggers an MSBuild deployment of an SSDT database project: void Deploy(string projectPath, string publishProfilePath, ILogger logger) { var project =…
Sam
  • 40,644
  • 36
  • 176
  • 219
0
votes
4 answers

MVC2: Can't convert String to ExtensionDataObject (without knowing I wanted to)

I'm getting the following InvalidOperationException: The parameter conversion from type 'System.String' to type 'System.Runtime.Serialization.ExtensionDataObject' failed because no type converter can convert between these types. In a Post action on…
Mike Pateras
  • 14,715
  • 30
  • 97
  • 137
0
votes
1 answer

c# smartdevice - HTTPWEBREQUEST GET vs POST InvalidOperationException

In the code below, DoGet is working very stable. But DoPost throws an uncatcheable InvalidOperationException randomly. I am lost. Any pointers will be of immense help. /* Environment ------------- * NET CF 2.0 * WM 5.0(USA Mobile…
0
votes
1 answer

System.InvalidOperationException is scaring me

I recently reset my whole laptop. After the reset, I installed all of my programmes, including Visual Studio 2013 (I had 2012 on my last build). I then dumped my projects into the projects folder of 2013 and...I COULDN'T RUN MY PROJECT!!! I can view…
0
votes
2 answers

The ConnectionString property has not been initialized error

I'm using an asp.net web application with a MySql DB, with the following connetcion string the web.config:
0
votes
1 answer

cudafy throws an exception while testing

I'm using VS 2010 on a Windows 7 64x. I've created a static class Cuda with the following code namespace Network { public static class Cuda { static GPGPU gpu= CudafyHost.GetDevice(); static CudafyHost host = new…