Báo lỗi the invocation of the constructor of type năm 2024

this is the error while debugging the above code:"The invocation of the constructor on type 'WpfApplication1.MainWindow' that matches the specified binding constraints threw an exception.' Line number '8' and line position '9'."

since the beginning of the project I am using xmlns:dg="//schemas.microsoft.com/wpf/2008/toolkit" . so I can't remove this namespace and opt for DataGrid instead of dg:DataGrid. I know that the problem relies on the usage of the abobe namespace. anybody can help to resolve the issues at the same time retaining dg:

thanks in advance

Iqbal

in my case i had working the view in separate project and i got same error so all i did just copy the app.config to the view project and its ruing fine after that

This content, along with any associated source code and files, is licensed under The Code Project Open License [CPOL]

The invocation of the constructor on type 'Captura.MainWindow' that matches the specified binding constraints threw an exception.

`System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'Captura.MainWindow' that matches the specified binding constraints threw an exception. -> System.Runtime.InteropServices.COMException: Element nicht gefunden. [Exception from HRESULT: 0x80070490] at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal[Int32 errorCode, IntPtr errorInfo] at NAudio.CoreAudioApi.MMDeviceEnumerator.GetDefaultAudioEndpoint[DataFlow dataFlow, Role role] at Captura.Audio.NAudioItem.get_DefaultMicrophone[] at Captura.Audio.NAudioSource.get_DefaultMicrophone[] at Captura.Models.AudioSourceViewModel.RefreshMics[] at Captura.Models.AudioSourceViewModel..ctor[IAudioSource AudioSource] at DynamicInjectore1e462a108ac4972a94cc0b705d38fb3[Object[] ] at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.Planning.Targets.Target`1.ResolveWithin[IContext parent] at Ninject.Activation.Providers.StandardProvider.GetValue[IContext context, ITarget target] at Ninject.Activation.Providers.StandardProvider.c__DisplayClass15_0.b__0[ITarget target] at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext[] at System.Linq.Buffer`1..ctor[IEnumerable`1 source] at System.Linq.Enumerable.ToArrayTSource at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.Planning.Targets.Target`1.ResolveWithin[IContext parent] at Ninject.Activation.Providers.StandardProvider.GetValue[IContext context, ITarget target] at Ninject.Activation.Providers.StandardProvider.c__DisplayClass15_0.b__0[ITarget target] at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext[] at System.Linq.Buffer`1..ctor[IEnumerable`1 source] at System.Linq.Enumerable.ToArray[TSource][IEnumerable`1 source] at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.Planning.Targets.Target`1.ResolveWithin[IContext parent] at Ninject.Activation.Providers.StandardProvider.GetValue[IContext context, ITarget target] at Ninject.Activation.Providers.StandardProvider.c__DisplayClass15_0.b__0[ITarget target] at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext[] at System.Linq.Buffer`1..ctor[IEnumerable`1 source] at System.Linq.Enumerable.ToArrayTSource at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.ResolutionExtensions.GetResolutionIterator[IResolutionRoot root, Type service, Func`2 constraint, IEnumerable`1 parameters, Boolean isOptional, Boolean isUnique] at Ninject.ResolutionExtensions.Get[T][IResolutionRoot root, IParameter[] parameters] at Captura.MainWindow..ctor[] - End of inner exception stack trace --- at System.Windows.Markup.WpfXamlLoader.Load[XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri] at System.Windows.Markup.WpfXamlLoader.LoadBaml[XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri] at System.Windows.Markup.XamlReader.LoadBaml[Stream stream, ParserContext parserContext, Object parent, Boolean closeStream] at System.Windows.Application.LoadBamlStreamWithSyncInfo[Stream stream, ParserContext pc] at System.Windows.Application.LoadComponent[Uri resourceLocator, Boolean bSkipJournaledProperties] at System.Windows.Application.DoStartup[] at System.Windows.Application.b__1_0[Object unused] 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]`

`System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'Captura.MainWindow' that matches the specified binding constraints threw an exception. -> System.Runtime.InteropServices.COMException: Element nicht gefunden. [Exception from HRESULT: 0x80070490] at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal[Int32 errorCode, IntPtr errorInfo] at NAudio.CoreAudioApi.MMDeviceEnumerator.GetDefaultAudioEndpoint[DataFlow dataFlow, Role role] at Captura.Audio.NAudioItem.get_DefaultMicrophone[] at Captura.Audio.NAudioSource.get_DefaultMicrophone[] at Captura.Models.AudioSourceViewModel.RefreshMics[] at Captura.Models.AudioSourceViewModel..ctor[IAudioSource AudioSource] at DynamicInjectore1e462a108ac4972a94cc0b705d38fb3[Object[] ] at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.Planning.Targets.Target`1.ResolveWithin[IContext parent] at Ninject.Activation.Providers.StandardProvider.GetValue[IContext context, ITarget target] at Ninject.Activation.Providers.StandardProvider.c__DisplayClass15_0.b__0[ITarget target] at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext[] at System.Linq.Buffer`1..ctor[IEnumerable`1 source] at System.Linq.Enumerable.ToArrayTSource at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.Planning.Targets.Target`1.ResolveWithin[IContext parent] at Ninject.Activation.Providers.StandardProvider.GetValue[IContext context, ITarget target] at Ninject.Activation.Providers.StandardProvider.c__DisplayClass15_0.b__0[ITarget target] at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext[] at System.Linq.Buffer`1..ctor[IEnumerable`1 source] at System.Linq.Enumerable.ToArray[TSource][IEnumerable`1 source] at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.Planning.Targets.Target`1.ResolveWithin[IContext parent] at Ninject.Activation.Providers.StandardProvider.GetValue[IContext context, ITarget target] at Ninject.Activation.Providers.StandardProvider.c__DisplayClass15_0.b__0[ITarget target] at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext[] at System.Linq.Buffer`1..ctor[IEnumerable`1 source] at System.Linq.Enumerable.ToArrayTSource at Ninject.Activation.Providers.StandardProvider.Create[IContext context] at Ninject.Activation.Context.ResolveInternal[Object scope] at Ninject.Activation.Context.Resolve[] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request, Boolean handleMissingBindings] at Ninject.KernelBase.Resolve[IRequest request] at Ninject.ResolutionExtensions.GetResolutionIterator[IResolutionRoot root, Type service, Func`2 constraint, IEnumerable`1 parameters, Boolean isOptional, Boolean isUnique] at Ninject.ResolutionExtensions.Get[T][IResolutionRoot root, IParameter[] parameters] at Captura.MainWindow..ctor[] - End of inner exception stack trace --- at System.Windows.Markup.WpfXamlLoader.Load[XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri] at System.Windows.Markup.WpfXamlLoader.LoadBaml[XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri] at System.Windows.Markup.XamlReader.LoadBaml[Stream stream, ParserContext parserContext, Object parent, Boolean closeStream] at System.Windows.Application.LoadBamlStreamWithSyncInfo[Stream stream, ParserContext pc] at System.Windows.Application.LoadComponent[Uri resourceLocator, Boolean bSkipJournaledProperties] at System.Windows.Application.DoStartup[] at System.Windows.Application.b__1_0[Object unused] 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]`

Chủ Đề