invalidoperationexception

.NET xsd importer creates unserializable class

ぐ巨炮叔叔 提交于 2019-12-30 18:43:08
问题 I am using the .NET XSD.EXE importer to generate C# classes from a collection of XSD files. When I tried to serialize one of the classes to XML it failed ( InvalidOperationException ), and when I dug into it I discovered it one of the created classes appears to be wrong. Here is the pertinent XSD code: <xsd:complexType name="SuccessType"> <xsd:annotation> <xsd:documentation>Indicates in a response message that a request was successfully processed.</xsd:documentation> </xsd:annotation> <xsd

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

我们两清 提交于 2019-12-29 09:01:55
问题 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 Handler, the data gets updated & the DGV's custom refreshing method is called. While running the program, whenever I start editing a cell & end it by selecting another one, an exception is thrown: InvalidOperationException Operation is not valid

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

若如初见. 提交于 2019-12-29 07:35:15
问题 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, and it turns out that calling Application.Exit() is throwing a System.InvalidOperationException with the following message: A first chance exception of type 'System.InvalidOperationException' occurred in mscorlib.dll Additional information:

C# MSMQ Invalid Operation Exception

会有一股神秘感。 提交于 2019-12-25 08:58:53
问题 I create a basic application to manage MSMQ in C#. I create messages in my trasaction message queue with this method: /// <summary> /// Method to send message in message queue /// </summary> /// <param name="mq">message queue (to)</param> /// <param name="messageBody">message body</param> /// <param name="messageLabel">message label</param> public static void sendMessage(MessageQueue mq, string messageBody, string messageLabel) { MessageQueueTransaction mqt = new MessageQueueTransaction();

Why is this array list removal code failing?

社会主义新天地 提交于 2019-12-25 04:07:44
问题 I'm trying to remove specific values from a listbox by passing the corresponding text, looking for it in the listbox, and removing that item. With this code: private void UpdateGUIAfterTableSend(String listboxVal) { ExceptionLoggingService.Instance.WriteLog("Reached frmMain.UpdateGUIAfterTableSend"); try { listBoxWork.DataSource = null; // <= It seems necessary to set this to null to circumvent "Value does not fall within the expected range" for (int i = listBoxWork.Items.Count - 1; i >= 0; -

MapPageRoute - can't send empty strings in the middle?

て烟熏妆下的殇ゞ 提交于 2019-12-24 19:36:01
问题 In Global.asax.cs in a project that I'm maintaining there is a method that looks like this private static void MapRouteWithName(string name, string url, string physicalPath, bool? checkPhysicalUrlAccess = null, RouteValueDictionary defaults = null) { Route route; if ((checkPhysicalUrlAccess != null) && (defaults != null)) { route = System.Web.Routing.RouteTable.Routes.MapPageRoute(name, url, physicalPath, checkPhysicalUrlAccess.Value, defaults); } else { route = System.Web.Routing.RouteTable

InvalidOperationException: The property is part of the object's key information and cannot be modified

你说的曾经没有我的故事 提交于 2019-12-24 14:42:06
问题 I'm getting this error when I try to change column value. Here is how I got to this problem: 1) I was needed to add this bit column to an Existing table. ALTER TABLE BooksDB.dbo.Books ADD edited bit NOT NULL DEFAULT(0), 2) Updated my EF model in project. 3) Now when I try to change 'edited' property of entity object, I'm getting the error from Subject line. Why is that? EF object declaration: /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute

Execute multiple controller actions in one call with MVC.Net 5

十年热恋 提交于 2019-12-24 10:59:08
问题 We have recently upgraded our code base from .Net 4.0 to .Net 4.5.1 and from MVC 2.0 to MVC 5.2.2. We have a custom method in our base controller class which allowed us to update multiple parts of our views within a single request. Since upgrading, this no longer works. Original Code: protected void IncludeAction(string actionName, string controllerName, object routeValues) { //Get Url RouteValueDictionary routes = null; if (routeValues != null) routes = new RouteValueDictionary(routeValues);

“InvalidOperationException: Object is currently in use elsewhere” during innocuous onpaint?

若如初见. 提交于 2019-12-24 07:17:13
问题 For some reason we are getting "InvalidOperationException: Object is currently in use elsewhere." during our custom OnPaint, below (that's actually almost a line for line copy of the code... there's that little there). We have logging in the exception handler below to detect if we're somehow calling OnPaint from a non-UI thread... and that isn't getting tripped, but we are getting that error logged (see stack trace below). On machines where we're getting these errors, we're also seeing the

When Adding Data Annotation Attribute it's throwing Exception

╄→尐↘猪︶ㄣ 提交于 2019-12-24 05:24:10
问题 public class Employee { [Key] public int Id { get; set; } public string Name { get; set; } public string Address { get; set; } public decimal Salary { get; set; } public string Email { get; set; } } public class EmployeeContext : DbContext { public DbSet<Employee> Employees { get; set; } } When I'm adding Data Annotation [Required(ErrorMessage = "Employee Name is required")] to the Name property it's throwing an InvalidOperationException . As I was trying to fix the bug I'm getting these