Isn't that a crazy error?
I get this when trying to open a form containing some UserControls from another assebly and using Entity Framework and SQL CE on visual studio designer.
Object of type Namespace.T[] cannot be converted to type Namespace.T[]!!!
Call Stack:
at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast) at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr) at System.Reflection.RtFieldInfo.InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean doVisibilityCheck, Boolean doCheckConsistency) at System.Runtime.Serialization.FormatterServices.SerializationSetValue(MemberInfo fi, Object target, Object value) at System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder holder, Boolean bObjectFullyComplete) at System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder holder) at System.Runtime.Serialization.ObjectManager.RegisterObject(Object obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj, MemberInfo member, Int32[] arrayIndex) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord pr) at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr) at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) at System.Resources.ResXDataNode.GenerateObjectFromDataNodeInfo(DataNodeInfo dataNodeInfo, ITypeResolutionService typeResolver) at System.Resources.ResXDataNode.GetValue(ITypeResolutionService typeResolver) at System.Resources.ResXResourceReader.ParseDataNode(XmlTextReader reader, Boolean isMetaData) at System.Resources.ResXResourceReader.ParseXml(XmlTextReader reader)
But its the same name type exactly!
The project builds successfully and runs ok!!!
OK i deleted the .resx file of the form and now i get 2 other errors i thought i have passed.
1st is "The specified named connection, not intended to be used with the EntityClient provider, or not valid"
Call Stack:
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) at DJPro.Settings.Model.SettingsEntities..ctor() in D:\Visual Studio Projects\DJProAutomation\DJPro.Settings.Model\SettingsSelfTrackModel.Context.cs:line 33 at DJPro.Data.Access.SettingsDataOperations.GetConfiguration() in D:\Visual Studio Projects\DJProAutomation\DJPro.Data.Access\SettingsDataOperations.cs:line 33 at DJPro.Studio.Controls.DeckControl..ctor() in D:\Visual Studio Projects\DJProAutomation\DJPro.Deck.Controls\DeckControl.cs:line 51
2nd is about a control i have on a library saying.
"The variable deckControl1 is either undeclared or was never assigned"
Call Stack:
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression) at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
Then restored from a backup the resx file and im going back to the first problem.
So strange errors, everything seems fine in the Entity Data Model libraries and the app.config has all the necessary connection strings. As for the deckControl1 UserControl it seems fine to the library i have created it and opens ok.
I think this gets me crazy enough and stops the development.
Any idea?
It looks like you have a version conflict between the assembly used to generate the ResX and the currently referenced assembly.
Try removing the reference, re-adding it as a project reference, and regenerating the ResX.
Found the problem, if you use in UserControl constructor code that initializes entity framework context provides problems....even problem can occur while trying to initialize context for data operations in the Load event handler.
Tricky!
Related
I am getting below error in SpecFlow (2.1.o) in VS 2107 in one of the steps in feature file. Should it be something related to SpecFlow framework issue?
But I don't have this error in other features. They are working fine.
Error in XXXXfeature.cs file:
Test method ABC.Api.Bdd.Tests.Features.V2.InstantTrackerFeature.InstantTrackerReturnsA500ErrorResponseWhenErrorScenariosOccur threw exception:
System.InvalidCastException: Object must implement IConvertible.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at TechTalk.SpecFlow.Bindings.StepArgumentTypeConverter.ConvertSimple(Type typeToConvertTo, Object value, CultureInfo cultureInfo)
at TechTalk.SpecFlow.Bindings.StepArgumentTypeConverter.ConvertSimple(IBindingType typeToConvertTo, Object value, CultureInfo cultureInfo)
at TechTalk.SpecFlow.Bindings.StepArgumentTypeConverter.Convert(Object value, IBindingType typeToConvertTo, CultureInfo cultureInfo)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ConvertArg(Object value, IBindingType typeToConvertTo)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.<>c__DisplayClass38_0.<GetExecuteArguments>b__0(Object arg, Int32 argIndex)
at System.Linq.Enumerable.<SelectIterator>d__5`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.GetExecuteArguments(BindingMatch match)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
at ABC.Api.Bdd.Tests.Features.V2.InstantTrackerFeature.ScenarioCleanup()
at ABC.Api.Bdd.Tests.Features.V2.InstantTrackerFeature.InstantTrackerReturnsA500ErrorResponseWhenErrorScenariosOccur() in C:\ABC.API\ABC.Api.Bdd.Tests\features\v2\InstantTracker.feature:line 36
The reason for the error was missing StepArgumentTransformation. as below.
[StepArgumentTransformation]
public IList<MovesStaging> TransformMovesStaging(Table identifiers)
{
return identifiers.Rows.Select(row => new MovesStaging
{
PartitionKey = ParseTableRowFieldAsString(row, "PartitionKey"),
RowKey = ParseTableRowFieldAsString(row, "RowKey"),
Timestamp = ParseTableRowFieldAsTimeStampUtc(row, "Timestamp"),
Status = ParseTableRowFieldAsString(row, "Status"),
ExpiryDate = ParseTableRowFieldAsDateTimeUtc(row, "ExpiryDate")
}).ToList();
}
Basically whenever you try to insert data through feature file you need to have this.
I came across similar type of question after that. I missed the question perhaps due to the subject.
I am trying to migrate a Team Project from TFS 2015 to Visual Studio Team Services. I connected to both the Source and Destination, selected the Team Project, mapped my users, and then when validating the Migration Summary a NullReferenceException is thrown.
The following was found in the OVSMU.log file:
2016-07-29 10:33:20,674 [1] ERROR Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at TFSMigrationUI.ViewModel.MigrationSummeryViewModel.worker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e) in c:\Project_CheckOut\TFSMigration\TFSMigrationUI\ViewModel\MigrationSummeryViewModel.cs:line 1096
at System.ComponentModel.BackgroundWorker.OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Has anyone seen a similar problem?
I have Sitecore instance 6.6 updated from 6.3. After the update an exception occurs when right-clicking on the left side of the content tree. That's the space where you can choose to show the lock icon and so on. Here's a screenshot:
This is the error message:
[ArgumentException: Empty strings are not allowed.
Parametername: header]
Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName) +241
Sitecore.Web.UI.HtmlControls.Menu.Add(String id, String header, String icon, String hotkey, String click, Boolean check, String radiogroup, MenuItemType type) +68
Sitecore.Shell.Applications.ContentManager.ContentEditorForm.Gutter_ContextMenu() +637
[TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +808
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +38
Sitecore.Shell.Framework.Commands.MethodCommandProcessor.Invoke(PipelineArgs args) +427
Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline) +330
Sitecore.Pipelines.Pipeline.DoStart(PipelineArgs args) +208
Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic) +182
Sitecore.Shell.Framework.Commands.MethodCommand.Execute(CommandContext context) +499
Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +530
Sitecore.Shell.Applications.ContentManager.ContentEditorPage.OnPreRender(EventArgs e) +25
System.Web.UI.Control.PreRenderRecursiveInternal() +108
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
Any idea how I can fix this?
There's a couple of things you need to check and doublecheck.
1) Is your Sitecore.Kernel.dll in /bin the correct version for 6.6. A very common mistake to make is, to go through the upgrade fine and then rebuild your project - forgetting that your local obj and bin folders hold Sitecore DLLs for 6.3 that then gets copied to /bin.
To fix this, first try and take the entire /bin directory from your 6.6 zip and copy/replace it to your website /bin. See if the issues goes away.
2) If not, check our commands.config (located in App_Config/Include) and make sure it's the right version for 6.6.
These two, is where I would start looking first.
I found out what caused this error. The items in the core database of that menu lost their language versions during the update. After creating the language versions of those items in the core db, the menu shows up again.
This is a long shot...
I'm using spring 1.3.2 and at random times I get ArgumentNullException exception (See stack trace below).
I'm configuring the container in a mix between XML and Code (by using ObjectDefinitionBuilder directly, no code config). And the registrations take place in parallel (5 threads loading definitions).
All my objects use Autowiring via Constructor, the error happens in both components that have items in the constructor or not.
I'm doing the following call after everything was registered in the container
context.GetObjectsOfType(typeof (IFoo)).OfType<DictionaryEntry>().Select(d => (IFoo) d.Value)
From the stack trace and looking at the code, I see that the call to IsAlias seems to be failing, but not sure I understand how this can happen.
Any thoughts/Ideas?
Stack Trace:
Spring.Objects.Factory.ObjectCreationException: Error creating object with name 'My.App.SomeFooImplementation' : Initialization of object failed : Key cannot be null.
Parameter name: key ---> System.ArgumentNullException: Key cannot be null.
Parameter name: key
at System.Collections.Hashtable.ContainsKey(Object key)
at System.Collections.Specialized.OrderedDictionary.Contains(Object key)
at Spring.Objects.Factory.Support.AbstractObjectFactory.IsAlias(String name)
at Spring.Objects.Factory.Support.DefaultListableObjectFactory.DoGetObjectNamesForType(Type type, Boolean includeNonSingletons, Boolean allowEagerInit)
at Spring.Objects.Factory.Support.DefaultListableObjectFactory.GetObjectNamesForType(Type type, Boolean includePrototypes, Boolean includeFactoryObjects)
at Spring.Objects.Factory.ObjectFactoryUtils.ObjectNamesForTypeIncludingAncestors(IListableObjectFactory factory, Type type, Boolean includePrototypes, Boolean includeFactoryObjects)
at Spring.Objects.Factory.Support.DefaultListableObjectFactory.FindAutowireCandidates(String objectName, Type requiredType, DependencyDescriptor descriptor)
at Spring.Objects.Factory.Support.DefaultListableObjectFactory.ResolveDependency(DependencyDescriptor descriptor, String objectName, IList autowiredObjectNames)
at Spring.Objects.Factory.Support.ConstructorResolver.CreateArgumentArray(String objectName, RootObjectDefinition rod, ConstructorArgumentValues resolvedValues, ObjectWrapper wrapper, Type[] paramTypes, MethodBase methodOrCtorInfo, Boolean autowiring, UnsatisfiedDependencyExceptionData& unsatisfiedDependencyExceptionData)
at Spring.Objects.Factory.Support.ConstructorResolver.AutowireConstructor(String objectName, RootObjectDefinition rod, ConstructorInfo[] chosenCtors, Object[] explicitArgs)
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.CreateObjectInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure)
--- End of inner exception stack trace ---
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure)
at Spring.Objects.Factory.Support.AbstractObjectFactory.CreateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectInternal(String name, Type requiredType, Object[] arguments, Boolean suppressConfigure)
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name)
Edit:
I just got all the definition names and somehow there is a null entry in there, that seems to be the issue, not sure why it is happening yet...
The only fix I could come up with was to change the internal objectDefinitionNames ArrayList to be wrapped with ArrayList.Synchronized with reflection. Not nice at all but seems to do the job.
var field = factory.GetType().GetField("objectDefinitionNames", BindingFlags.NonPublic | BindingFlags.Instance);
if (field == null)
throw new InvalidOperationException("Could not get Definitions field from application context.");
var value = (ArrayList) field.GetValue(factory);
field.SetValue(factory, ArrayList.Synchronized(value));
I'm very new to WPF and the EF, and I'm trying to display some data from a table in a datagrid. I've got the entity model pulled from an existing database and simple operations seem to work (getting row counts, using 'first').
I'm running against Firebird 2.5.0 using the 2.0.5 DDEX provider and 2.5.2 ADO NETProvider.
When I try to get the data into the grid or simply into a list, I get a null reference exception.
Possibly I just don't understand how to use the entity framework, but the examples I see on the net make it look really easy.
public partial class Page1 : Page
{
Entities context;
public Page1()
{
context = new Entities();
InitializeComponent();
// This works to get a row into the grid
var arep = context.SALESREPs.First();
var alist = new List<SALESREP>();
alist.Add( arep );
gridUserList.ItemsSource = alist;
// These both fail with null ref exception
var allreps = context.SALESREPs.ToList();
gridUserList.ItemsSource = context.SALESREPs;
}
}
Here's the exception detail:
System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
Source=System.Data.Entity
StackTrace:
at System.Data.EntityKey.AddHashValue(Int32 hashCode, Object keyValue)
at System.Data.EntityKey.GetHashCode()
at System.Collections.Generic.GenericEqualityComparer`1.GetHashCode(T obj)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at System.Data.Objects.ObjectStateManager.TryGetEntityEntry(EntityKey key, EntityEntry& entry)
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at PSUserMaintenanceWebUI.Page1..ctor() in C:\Documents and Settings\d...\my documents\visual studio 2010\Projects\UserMaintenance\UserMaintenanceWebUI\Page1.xaml.cs:line 36
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.InvokeDelegate(Action`1 action, Object argument)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CallCtorDelegate(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CreateInstance(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)
InnerException:
My table has a multi-field primary key with some of the fields being nullable. The entity framework doesn't like nullable fields in the primary key. I removed those rows and it works fine. I'm already in the process of finding a different solution to the requirement that prompted us to allow nulls in some of the primary key fields.