Reputation: 1098
This error appears whenever I save changes to my screen. The last thing I was working on is creating relationships in WCF RIA Services. I have looked at all of the exception information and attempted to step through my code in the debugger to just before it's thrown, all with no results. The 'name' reference is no use, I commented every bit of code that references a 'name'. It appears to be one of those exceptions that tells you almost nothing about the issue.
[Microsoft.LightSwitch.DataService][Application:Error][LightSwitchServiceApplication.WCF_RIA_ServiceData:SaveChanges] An exception has occurred: Microsoft.LightSwitch.DataServiceOperationException: Invalid argument 'name' ---> System.ArgumentException: Invalid argument 'name'
at Microsoft.LightSwitch.Platform.Utilities.Internal.Parameter.ThrowArgumentException(String parameterName)
at Microsoft.LightSwitch.Details.Framework.Base.DetailsSet`3.GetItemCore(String name)
at Microsoft.LightSwitch.Details.Framework.Base.DetailsSet`1.get_Item(String name)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.RiaDataProvider.HandleErrors(ChangeSet changeSet, List`1 entityPairs)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.RiaDataProvider.SubmitCore(IEnumerable`1 changes)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataProvider.DataProvider.Submit(IEnumerable`1 changes)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.PerformPersistCore(IEnumerable`1 eventsChangeSetItems)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.<>c__DisplayClass46.<PerformPersist>b__45()
at Microsoft.LightSwitch.Threading.DualDispatcherObject.Mutate(IDispatcher logicDispatcher, MutatorHost host, Action mutator)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.PerformPersist(IEnumerable`1 eventsChangeSetItems)
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.Microsoft.LightSwitch.ServerGenerated.Implementation.IServerDataServiceImplementationCore.Submit()
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataService`1.<>c__DisplayClass12.<Microsoft.LightSwitch.ServerGenerated.Implementation.IODataService.SaveChanges>b__10()
at Microsoft.LightSwitch.ServerGenerated.Implementation.DataServiceImplementation`1.InvokeOperationCore[T](String operationName, Object[] args, Boolean invokedFromODataClient, Func`1 invokeOperation, Action catchCallback, Action`2 serializeCustomExceptionInfo)
--- End of inner exception stack trace ---
Upvotes: 0
Views: 892
Reputation: 1098
This run-time error comes about if you use a nullable property in a WCF RIA Services class, update the data source in LightSwitch, and then mark it as [Required]
in RIA Services.
Required forces a 1 to many (in my case) relationship in LightSwitch, and using a nullable type in RIA Services will give a syntax error about there being no implicit cast between the nullable type (RIA Services) and its non-nullable equivalent (LightSwitch).
However, if you create the nullable type first, LightSwitch will create a 0 or 1 to many relationship, then when you add Required to RIA Services this vague run-time exception is thrown.
Upvotes: 1