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

Complex model structure and InvalidOperationException on CancelViewModel

I have a model architecture similar to this one in a viewmodel (skipping the implementation as it is not relevant): public ObservableCollection Filetypes [Model] public Filetype Filetype [ViewModelToModel("Filetype")] public…
Kilazur
  • 3,089
  • 1
  • 22
  • 48
0
votes
1 answer

Microsoft WPF Map Control - InvalidOperationException - "Cannot perform this operation while dispatcher processing is suspended."

I have a WPF application built on .NET 4.5. The latest version of the map control (version 1.0.1.0) is causing an issue if it is used within a datatemplate. This does not happen with the previous version I was using from NuGet (version 1.0.0.0). …
Jason Boyd
  • 6,839
  • 4
  • 29
  • 47
0
votes
3 answers

Why do I get "InvalidOperationException: No current row" with this code?

I'm trying to retrieve a row from a table using the GetInventoryRecordForUPC() method below. I can retrieve the row fine in LINQPad by entering "SELECT invName, line_id, ref_no, upc_code, description, department, vendor_id, upc_pack_size, pack_size,…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
0
votes
2 answers

Strange XmlSerializer behavior

So i'm having some trouble deserializing an XML file. I'm using the following struct. [Serializable] public struct GraphicsOptions { public int Height; public int Width; public bool Fullscreen; public bool AntiAliasing; public…
0
votes
1 answer

SharePoint and the fantastic System.InvalidOperationException

This is not a question! We have found the solution (I post it later as answer). I hope this can be helpful to someone. Our custom wcf service (deployed in SharePoint 2013) threw a InvalidOperationException inside a…
Seahorse
  • 35
  • 1
  • 1
  • 5
0
votes
1 answer

Powershell : Cannot compare array.Length with int32

I am creating a ps script that will handle different user commands. Since every function the user can call has a different number of parameters I just wanted to pass the rest of the usrInput[] array starting from index 1 as a parameter of the…
0rube
  • 72
  • 1
  • 11
0
votes
1 answer

WCF Exception: Cannot add to list of known types

Good Day Everyone... I’m getting an unexpected WCF error complaining of “Known Types” which are similarly named, but in different name-spaces (see error below). ...please keep in mind I'm still experimenting with all this. Also… I already understand…
Prisoner ZERO
  • 13,848
  • 21
  • 92
  • 137
0
votes
0 answers

Using session state in web-services

I have a web-service written in C# that I am consuming. I now need to make use of session state in order so that I can maintain state in between web-service calls. I've read online that I need to use internal state collections for that. I declared a…
0
votes
1 answer

There is an error in XML document (155, 23). No error and always on page 13

I've got some trouble parsing some XML-data in C#. Method summary: The method takes a keyword and then search for that keyword at www.clinicaltrials.com by using the website URI. For instance:…
Ørjan
  • 2,749
  • 2
  • 16
  • 24
0
votes
3 answers

Decimal? - Nullable object must have a value

I'm using VB.NET MVC 5.1 in VS2013 using Razor siq.Price is a Decimal? I'm trying to check if siq.Price has a value, and if so print it as a currency. I recieve this error when trying to access the .Value property for elements where true they…
0
votes
1 answer

Partial view works different inside areas and outside of them

i have two controllers outside the areas and a few areas for my application my Layout page contains a partial view rendering code: @Html.Action(actionName: "LoginBar", controllerName: "Login") and it is registered in RouteConfig …
0
votes
2 answers

LINQ to SQl updating primary key field?

I have a linq to sql table/class that uses a GUID as both a primary key and as foreign key. This problem came up when factoring some code that previously worked. The exception generated is "Operation is not valid due to the current state of the…
Curtis White
  • 6,213
  • 12
  • 59
  • 83
0
votes
3 answers

Invalidoperationexception when using EnumerableRowCollection and DateTime

I have recently found the following lines in a for loop are giving me an error. The error is from the stepEndTime, the last line of code shown below: EnumerableRowCollection RowFirstStep =…
hlyates
  • 1,279
  • 3
  • 22
  • 44
0
votes
1 answer

HttpResponseMessage System.InvalidOperationException

Quite a simple problem I've got that would be easy to solve I reckon for the brains. It's just a tried a different queries on Google and nothing popped up but hey that's why I am here. Here is the error:…
0
votes
1 answer

SelectedIndex or SelectedItem of ListPicker with DataTemplate

I am using Listpicker to allow users to select color. So i used a Toolkit Listpicker with a DataTemplate that includes Textbox to display its list items. What I want is when the page loads, the previously selected color(item) gets automatically…