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

Invalid Operation error

I am getting Invalid Operation Error in following code. int m = l_score.Min(); where l_score is int list. Why this would happen ? Edit: Code List l_origin = new List(); List l_k = new List(); List l_score = new…
John Watson
  • 869
  • 3
  • 16
  • 32
0
votes
1 answer

VB.Net 2008 "InvalidOperationException was unhandled" when trying to show or hide forms

I have multiple forms in my program. The menu form (frmMenu) contains buttons that will hide the menu form and show their corresponding form e.g. form frmXyl. Closing the form frmXyl should hide it and show the form frmMenu. 'Form frmMenu button…
0
votes
1 answer

Exception on Application Closing

I developed a WPF Application where I have problems when closing the application. Only on Windows 2003 PCs, the application throws the following exception on closing. But it does not seem to be thrown from my code, because I can't get a…
BitKFu
  • 3,649
  • 3
  • 28
  • 43
0
votes
1 answer

Selenium C# RemoteWebDriver not finding XPath Elements

I'm using Selenium 2.25.1 API, and I'm trying to be able to find the elements using RemoteWebDriver(). Except when I try, it just fails to find the element. I've tried several different combinations with no luck and have been looking this up for a…
0
votes
2 answers

Constructor is not on the thread which owns the object

I have a side-window that is opened when clicking a button on the main window. This side-window is created on a separate thread from the main window. When I click the button the first time, everything runs fine. Then I close the side-window. Now…
Brett
  • 298
  • 2
  • 16
0
votes
2 answers

InvalidOperationException when creating PerformanceCounter

i'm trying to get the actual free memory. It seems to be the easiest solution to use Performance Counters. It works totally fine on my Coding Machine, unfortunately I get an Exception on the target Computer. I use Windows XP an .NET 3.5 Can you…
0
votes
3 answers

C# "InvalidOperationException : ExecuteNonQuery" Exception

I have this error when I try to save some data to my sql (express) through the software I have create. An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll. Additional information: ExecuteNonQuery:…
dbexec
  • 274
  • 9
  • 19
0
votes
2 answers

InvalidOperationsException during XML-Serialization in XNA

I have a question concerning an Error I experience while trying to read an XML-File through the XNA 4.0 Content Pipeline in order to build Objects. First I reused old XNA 3.1 Code of mine which worked back in the day but now throws the an Error…
0
votes
2 answers

Read-only access to brush in Backgroundworker

I have a list of objects which among other properties contain a Brush (property name "Color"). In a Backgroundworker I want to write the contents of these objects to a file. Everything works fine until I try to read the color of the brush…
0
votes
2 answers

invalidOperationException while using delegate in thread

I divided my programme in 3 layers; GUI, BL, IO and tried to grap files from my server to my pc. I made it multi threaded and zorks fine, but when i tried to add a delegate to it for sending messages from my IO to my GUI, it troubels me. It said…
0
votes
1 answer

Inconsistent occurrence of 'System.InvalidOperationException' - How to log/trace what happens?

I'm having problems with an ASP.NET WebForms application, throwing 'System.InvalidOperationException', causing the site to crash (and restarting the application pool temporarily "solves" the issue). In my development environment I have never seen…
Niclas Lindqvist
  • 1,412
  • 2
  • 17
  • 24
-1
votes
2 answers

Linq Count List InvalidOperationException on no values

I'm trying to get the amount of CheckIns in the last hour from a scoped Background Service with injected DbContext. Following queries work as expected. var checkins = _dbContext.CheckIns.ToList(); var checkinList = checkins.Where(x =>…
BHANG
  • 354
  • 1
  • 5
  • 16
-1
votes
7 answers

a question about exception in c#

following is a code snippet: class xxx { public xxx(){} try { throw new Exception(InvalidoperationException); } catch(Exception x) { } catch(InvalidoperationException x) { } } can anyone tell which exception will raise…
karthik
  • 4,485
  • 8
  • 30
  • 45
-1
votes
4 answers

Why am I getting an InvalidOperationException?

So I have a constructor and a method that returns a card. I'm getting an InvalidOperationException for some reason. Anyone can think of anything? The cards list is not empty, I just removed the card generation algorithm from the constructor here to…
Sadiq
  • 2,249
  • 2
  • 24
  • 32
-1
votes
1 answer

Getting exception every time I delete an item from rectangle array

I am getting System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute. every time I want to remove an item from the array, so I could draw (fill) another rectangle at that place. Everything is happening on…
LordRed
  • 31
  • 4