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
13
votes
4 answers

Why is XmlSerializer throwing an InvalidOperationException?

public void Save() { XmlSerializer Serializer = new XmlSerializer(typeof(DatabaseInformation)); /* A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll A first chance…
qster
  • 1,129
  • 3
  • 9
  • 11
13
votes
2 answers

InvalidOperationException with Process

I'm starting a new process using the following code: Process p = new Process(); p.StartInfo.FileName = "..."; p.StartInfo.Arguments = "..."; p.Start(); p.WaitForExit(300000); // 5 minutes if (!p.HasExited) …
Morgan M.
  • 846
  • 2
  • 9
  • 27
13
votes
1 answer

How can I add logic to an existing dependency-property callback?

I'm trying to add a PropertyChangedCallback to UIElement.RenderTransformOriginProperty. An exception is thrown when I try to override the PropertyMetadata. I have searched MSDN and Google, and all I have been able to come up with is this.…
Giffyguy
  • 20,378
  • 34
  • 97
  • 168
12
votes
4 answers

Windows Application has stopped working :: Event Name CLR20r3

I developed an applicatin using Visual Studio.Net 2008 Team System with Infragistics Net Advantage Tools 2010.3 and made a Setup Exe file for my application and installed on client machines where they have both Windows7 32 bit and WindowsXP Service…
Malik
  • 207
  • 2
  • 6
  • 13
12
votes
6 answers

C# console application Invalid Operation Exception

using System; using System.Collections.Generic; using System.Text; using System.Data.Sql; using System.Data.SqlClient; namespace BissUpdater { class Program { static void Main(string[] args) { string…
mnlfischer
  • 397
  • 4
  • 12
  • 26
11
votes
1 answer

What is a parent freezable? What does this error mean?

I'm getting this error: Cannot use a DependencyObject that belongs to a different thread than its parent Freezable What does that even mean? Is it in English? Is the parent frozen, or is it just freezable? Any way to make a parent not…
mmr
  • 14,781
  • 29
  • 95
  • 145
11
votes
2 answers

Why is this code throwing an InvalidOperationException?

I think that my code should make the ViewBag.test property equal to "No Match", but instead it throws an InvalidOperationException. Why is this? string str = "Hello1,Hello,Hello2"; string another = "Hello5"; string retVal =…
10
votes
2 answers

System.InvalidOperationException due to collection modification on call to Application.Exit()

I've got this really, really weird error that I've never been able to pin down (it happens very rarely). Basically, I have a C# application that was randomly throwing an unknown exception on exit. I've managed to catch it in the debugger this time,…
Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
10
votes
3 answers

Periodic Exception in WSDL Export Extension

I have a SOAP service that's been running for a little over a month now. Over the past two weeks we've had situations where the service will randomly start to generate exceptions. Each time, they seem to be related to the export extension, and the…
10
votes
1 answer

decimal.InvalidOperation in python

I was testing my code and I thought that this piece of code was correct: while True: try: p = Decimal(raw_input(...)) if ...condition... : break else: raise ValueError except ValueError: print "Error!…
Pigna
  • 2,792
  • 5
  • 29
  • 51
9
votes
1 answer

Python cdecimal InvalidOperation

I am trying to read financial data and store it. The place I get the financial data from stores the data with incredible precision, however I am only interested in 5 figures after the decimal point. Therefore, I have decided to use t =…
user1094786
  • 6,402
  • 7
  • 29
  • 42
9
votes
3 answers

Custom ChangeMonitor for .Net MemoryCache causes invalid operation exception

I have written my own custom change monitor class for the .NET MemoryCache. It seems to initialize fine, but when I attempt to add it to the Cache, it throws an InvalidOperation exception - The method has already been invoked, and can only be…
Keith
  • 1,119
  • 2
  • 12
  • 23
9
votes
2 answers

How to evade reentrant call to setCurrentCellAddressCore?

I have a function that is called from cell_endedit. It moves a dataGridViewRow inside a dataGridView: private void moveRowTo(DataGridView table, int oldIndex, int newIndex) { if (newIndex < oldIndex) { oldIndex += 1; } else…
Juggernaut
  • 315
  • 1
  • 3
  • 9
8
votes
4 answers

.NET Core 2.x Identity int foreign key cannot target int primary key

I have a web application running .net core 2.x (just upgraded from .net core 1.x finally) and I've gotten most everything ported from .net core 1.x to 2.x. I have however hit a brick wall with my Identity implementation. It worked fine with .net…
8
votes
2 answers

Socket/threading problem: The Undo operation encountered a context that is different from what was applied in the corresponding Set operation

I'm having problems with the above much asked-about error. We have a TCP/IP server application which has been working fine for some years. I now need to allow the application to accept connections from directly connected USB devices, by internally…
1
2
3
33 34