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

Log.txt of an unhandled exception of type 'System.InvalidOperationException'

I am currently working on a way to log into a text file an exception error of type System.InvalidOPerationException via a try{}... catch{} block. My concern is that Log.txt outputs: Message :Exception of type 'System.Exception' was thrown. …
dark.vador
  • 619
  • 1
  • 6
  • 25
0
votes
1 answer

WCF invalidoperationexception

I encounter this strange problem while using wcf services along with L2SQL DAL. The server is hosted at the localhost and contains an implementation of the correspondent interface. The client is familiar with the interface and occasionally queries…
Gena Verdel
  • 588
  • 5
  • 21
0
votes
1 answer

Error An object with the same key already exists in the ObjectStateManager. with ViewModel

i know there are quite a few questions to this error, but i couldnt solve my problem with them. So i get the error: InvalidOperationException An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot…
0
votes
1 answer

C# SQL Server input

I am testing using a SQL database in C#. I followed the instructions from the MSDN to doing so. Here is the code: using System; using System.Collections.Generic; using System.Data.Linq; using System.Data.Linq.Mapping; using System.Linq; using…
mmf1102
  • 61
  • 1
  • 12
0
votes
1 answer

How do I check for NULL values in the following query; using vb.net?

I am struggling to get the syntax correct for the below code; I know I need to use ?? and possibly a datatype with ?; but getting it to actually work is a different story... any help would be appreciated; thanks! Here is my code: Dim products =…
Tim
  • 1
  • 2
0
votes
0 answers

"System.InvalidOperationException: Collection was modified" (but I am not attempting to modify the collection)

I'm working in Visual Studio Professional 2013, coding in C# with WPF. I am enumerating over the entries in a dictionary to concatenate a MySQL query, however my function keeps raising an exception "A first chance exception of type…
0
votes
1 answer

InvalidOperationException: Sequence contains more than one element - SingleOrDefault()

using (var db = new ABC()) { for (int column = rangeClass2.Start.Column; column <= rangeClass2.End.Column; column++) { var classValue = censusSheet.Cells[row, column].Value; var description = censusSheet.Cells[3, 27].Value; …
0
votes
2 answers

C++ ) Invalid operands to binary expression Error with Priority Queue

I have a struct(A) and Priority Queue(PQ) at another struct(B). This is struct A below : struct Node{ int level; int total; std::vector sequence; void clear(){ sequence.clear(); } void init(){ level = 0; total = 0; …
LKM
  • 2,410
  • 9
  • 28
  • 53
0
votes
1 answer

Service error when running my Unit test

I initially wrote a unit test to fail, now i have addressed the issue, but when i try to run my unit test again, i get this error System.InvalidOperationException : Could not find default endpoint element that references contract…
floormind
  • 1,868
  • 5
  • 31
  • 85
0
votes
2 answers

input file from command line

I'm here to trying to take input from the file. If user run this .exe from cmd and give a filename like example.exe input.txt then it shows the file and read. But if user doesn't give the file name then it run as simply program's run. Program is…
0
votes
1 answer

Rhino Mocks Stub with a generic interface causes InvalidOperationException

I'm running into what appears to be a Rhino Mocks problem when using a Generic Interface. When creating the stub for the update method an InvalidOperationException is thrown Interface public interface IDB { String add(T obj); void…
0
votes
1 answer

The entity type dbip_lookup is not part of the model for the current context when I add a new table to my existing model

I really need some help with this. I added a new table from my database to my .NET model and I created manually the entity class and the reference to access it but at runtime this error occurs... Can you help me out? This code is the one that tries…
0
votes
0 answers

Delphi XE TMediaPlayer "invalid floating point operation" on Windows 8/10

We have a program that plays a video in a corner of a form and it has been working for several years on W7, however some of our customers are now using W8 and W10. When we play a video that works on W7, on W8 or W10 the player creates the exception…
0
votes
1 answer

InvalidOperationException on Editing SaveChange ASP.NET MVC

Here is my code for HTTPPost Edit action: [HttpPost, ActionName("Edit")] [ValidateAntiForgeryToken] public ActionResult Edit(int? id, HttpPostedFileBase upload) { if (id == null) { return new…
0
votes
1 answer

Nullable Decimal If Is Always True

I have a page that lists items within a Work Order. Each of these items has many properties, and an optional property of a discount. If there are no discounts on the Work Order we want to hide the column, and if there is we must show it for the…
Red
  • 3,030
  • 3
  • 22
  • 39