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
4
votes
1 answer

SaveFileDialog throws System.InvalidOperationException: 'My File.xlsx' is not a valid file name

A customer just had this error with our application, which basically happens when calling ShowDialog on a Microsoft.Win32.SaveFileDialog. The complete stack trace is the following: System.InvalidOperationException: 'My File.xlsx' is not a valid…
Carl
  • 1,224
  • 2
  • 19
  • 35
4
votes
1 answer

signalr InvalidOperationException

I recently started using Signal R library in ASP.Net MVC 3 application. I am able to use Signal R to send message to client. But I noticed that if I logged in to the application from another browser, I get following error - Exception type:…
user2370912
  • 41
  • 1
  • 2
4
votes
1 answer

DataGrid throws InvalidOperationException by Scrolling

I want to show in a DataGrid the contents of a file. (The file contains more than 200,000 lines) To show the Grid with the Data is fast. But when I use the Scrollbar (for down scrolling) I've got the following…
David
  • 4,027
  • 10
  • 50
  • 102
3
votes
3 answers

InvalidOperationException - When ending editing a cell & moving to another cell

I made a program in which I wanted to manually update the Data Grid View. -I have a Method to Refresh the DGV by clearing it and then reinserting the data. -Using the designer, I made an event handler for the DGV's CellEndEdit. Inside the Event…
random dude
3
votes
1 answer

I get an InvalidOperationException When Invoking a Service

The contract type HelloIndigo.Service is not attributed with ServiceContractAttribute. In order to define a valid contract, the specified type (either contract interface or service class) must be attributed with…
BlackFire27
  • 1,470
  • 5
  • 21
  • 32
3
votes
3 answers

C# custom Iterator implementation - prevent collection modification during foreach loop

I created a custom collection that implements IEnumerable(T) and a custom IEnumerator(T). I also added an Add() method to the custom collection which looks like this: public void Add(T item) { T[] tempArray = new T[_array.Length + 1]; for…
Marko
  • 311
  • 3
  • 10
3
votes
4 answers

Identify InvalidOperationException "Collection was modified; enumeration operation may not execute."

I've got a good old InvalidOperationException being thrown with the standard message Collection was modified; enumeration operation may not execute. The problem is, the enumerator isn't modifying itself, for example: private TRoute…
Ian
  • 33,605
  • 26
  • 118
  • 198
3
votes
1 answer

c#: "System.InvalidOperationException: Queue empty" and other errors while using SendKey.SendWait()

I wrote a program to send 'Enter' key to a certain active window. I used a Timer to get the title of the active window for the moment and act accordingly. I made an error log file so i can keep track of all the errors. Here's the code that's…
user714014
  • 31
  • 1
  • 3
3
votes
1 answer

Adding nodes to TreeView causes Thread-Exception

i have a little problem. I´ve made a class that manages my prefabs (predefined objects for my level-editor). On loading the prefabs at start, it creates TreeNodes for categories and each prefab and adds it to an TreeView that it knows by the…
SharpShade
  • 1,761
  • 2
  • 32
  • 45
3
votes
2 answers

How do I fix EmbeddedRessources in a ASP.NET web site?

I am trying to reference a js file in a class in an ASP.NET and I receive this error: Assembly 'XXX' contains a Web resource with name 'XXX' but does not contain an embedded resource with name 'XXX' Searching the web tell me I must have a Path…
jpsimard-nyx
  • 8,587
  • 6
  • 32
  • 48
3
votes
1 answer

Getting System.InvalidOperation exception while trying to execute command line script using C#

I am trying to execute a command to generate PDF file using phantomjs. If I execute following command using command prompt, everything works fine. C:\phantomjs-2.1.1\bin\phantomjs.exe C:\phantomjs-2.1.1\rasterize.js…
SharpCoder
  • 18,279
  • 43
  • 153
  • 249
3
votes
2 answers

Generating and passing complex content to the GUI thread in WPF/C#

I'm aware, and use, the xxx.Dispatcher.Invoke() method to get the background thread to manipulate GUI elements. I think I'm bumping up against something similar, but slightly different, where I want a long running background task to construct a tree…
3
votes
1 answer

InvalidOperationException on Application.Exit

Can someone tell me why the exitToolStripMenuItem_Click throws an InvalidOperationException. I know it happens due to plugin.Close() being called. However, I do not understand why. Closing the Form1 via the "X" button does not trigger the exception.…
Brian Boyd
  • 263
  • 1
  • 3
  • 11
3
votes
1 answer

glNamedBufferData fires GL_INVALID_OPERATION

I get an exception at the very begin of my sample, when I try to allocate geometry for the gound, here and here: at this point gl4.glNamedBufferData(vertexBuffer[0], Vertex.size() * vertices.size(), floatBuffer,…
elect
  • 6,765
  • 10
  • 53
  • 119
3
votes
1 answer

SQLite and EntityFramework InvalidOperationException

I'm working with Visual Studio 2013 and trying to create sample project using SQLite and EntityFramework downloaded from NuGet. When i run program i got this exception on the line below and i don't have any idea to repair…
Symeg
  • 115
  • 1
  • 10