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
0 answers

Socket ReceiveAsync reuse SocketAsyncEventArgs

I have a network equipment to which I connect once using sockets, and the connection is maintained open all the time until application closes. Now I have a class in C# that encapsulates the communication. There is a method SendMessage to the…
XMight
  • 1,991
  • 2
  • 20
  • 36
0
votes
0 answers

Canceling delegates on form close (C#)

A quick question about concurrency in C#. I have in my code the following method to update a textbox: public void diag(string text) { if (InvokeRequired) { Invoke(new Action(diag), text); } …
Bovaz
  • 375
  • 6
  • 20
0
votes
1 answer

How to use Bitmap for live and processing at a time?

I get Bitmap (25 per 1 second) from a camera using imageAvailable envent. I have to show it on a GUI and also procees that Bitmap. So I am using two bitmaps, one for the live and the other for the processing. The problem is I am getting the…
Balu
  • 137
  • 2
  • 11
0
votes
1 answer

GUI Freezes - Invalid Operation Exception c#

I have a GUI in c# where you can open log files. The program have 2 main functions: setTextMessageTextBox() which updates the GUI when needed (after each operation, giving the appropriate messages) private static void setTextMessageTextBox(){ …
0
votes
1 answer

Cannot save song from isolated storage, SaveSong method throws InvalidOperationException error

I'm building a FTP application for Windows Phone 8, and want to save the downloaded songs from the isolated storage to the media library. I check if the file exists in isostore, and it returns true, but when I'm using the SaveSong method it always…
0
votes
1 answer

Close a form on CheckChanged event

I have this section of code, which opens a form when the box is checked, then closes it when the box is unchecked: private void chkDupe_CheckedChanged(object sender, EventArgs e) { if (chkDupe.Checked == true) { input = 1; …
Ben
  • 2,433
  • 5
  • 39
  • 69
0
votes
2 answers

System.InvalidOperationException setting texbox text

I am using one thread running this code: try { Form1 f = getForm(); f.changePrice(price); } catch (Exception e) { Console.WriteLine("error: " + e); } Here is the changePrice method: public void changePrice(Int32 price) { …
0
votes
0 answers

BackgroudnWorker ProgressChanged InvalidOperationException

When I call to the ProgressChanged method I'm getting an InvalidOperationException I found out on MSDN that this happens because the WorkerReportsProgress is set to false but it is set to true in my program. This is the BW initializations: …
Yogevnn
  • 1,430
  • 2
  • 18
  • 37
0
votes
2 answers

ASP.NET MVC Ajax - InvalidOperationException, sequence contains no elements

Whenever I make an Ajax call to a certain method, it gives an InvalidOperationException with the message "sequence contains no elements", which is obvious as I want to verify that it gives an error when entering a non-existing article. The Ajax…
Zinoex
  • 512
  • 2
  • 8
  • 22
0
votes
0 answers

XmlSerializer invokes InvalidOperationException when parsing custom Element

I have a problem while Parsing a custom element with the XmlSerializer. My custom element looks like this (i removed all properties, it still does not work): using System.Windows.Controls; namespace MvvmControlChange.Content.Elements { public…
LocalHorst
  • 1,048
  • 2
  • 11
  • 24
0
votes
0 answers

RavenDb Smuggler error during multiple exports

I'm using C# to launch multiple process (ProcessStartInfo) which execute the Raven.Smuggler.exe (all at the same time). This is probably a bad practise (which I am changing soon). However I would like to know if the action of launching muliple…
goamn
  • 1,939
  • 2
  • 23
  • 39
0
votes
3 answers

Event handling raising InvalidOperationException - looking for advice

I am kind of new to programming in this manner - is there a way that I can work around or a recommended practice to using events and handlers? eg: class objectA { public List handlers; ... public onActionHappened { …
na9090
  • 125
  • 2
  • 13
0
votes
1 answer

I get an Exception InvalidOperationException and I don't know why

This is a part of chat with multi users and I want to deserialize in loop so every message I am getting for each user I have a can publish (this is the server side) public class ServerDLL { public TcpClient client { get; set; } public…
0
votes
1 answer

System.InvalidOperationException when managing a dialog

I have encountered an error called System.InvalidOperationException. Additional information: Specified element is already the logical child of another element. Disconnect it first. I have searched through internet for the solutions but none of them…
0
votes
1 answer

EntityFramework 5 - InvalidOperationException when accessing DbContext.ChangeTracker.Entries

in my DbContext implementation if have a method called "IsModified". This is used by the application to show some kind of "Dirty" state. Within the method i access the ChangeTracker of the DbContext like shown below. If i access the…