none
Target Invocation Exception has been unhandled by user code

    Question

  • Can any body give the reason for below problem. The error is thrown when I am using DevExpress 15.2 Components in my code.How I can rectify the problem

    System.Reflection.TargetInvocationException was unhandled by user code

      HResult=-2146232828

      Message=Exception has been thrown by the target of an invocation.

      Source=mscorlib

      StackTrace:

           at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

           at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

           at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)

           at System.Xaml.Schema.SafeReflectionInvoker.InvokeMethodCritical(MethodInfo method, Object instance, Object[] args)

           at System.Xaml.Schema.SafeReflectionInvoker.InvokeMethod(MethodInfo method, Object instance, Object[] args)

           at System.Xaml.Schema.XamlMemberInvoker.SetValueSafeCritical(Object instance, Object value)

           at System.Xaml.Schema.XamlMemberInvoker.SetValue(Object instance, Object value)

           at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)

           at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)

           at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Object obj, XamlMember property, Object value)

           at System.Xaml.XamlObjectWriter.SetValue(Object inst, XamlMember property, Object value)

           at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)

           at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)

           at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)

           at System.Xaml.XamlObjectWriter.WriteEndObject()

           at System.Xaml.XamlWriter.WriteNode(XamlReader reader)

           at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)

           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 MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)

           at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)

           at System.Windows.ResourceDictionary.set_Source(Uri value)

           at System.Windows.Baml2006.WpfSharedBamlSchemaContext.<>c.<Create_BamlProperty_ResourceDictionary_Source>b__342_0(Object target, Object value)

           at System.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(Object instance, Object value)

           at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)

           at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)

           at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Object obj, XamlMember property, Object value)

           at System.Xaml.XamlObjectWriter.SetValue(Object inst, XamlMember property, Object value)

           at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)

           at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)

           at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)

           at System.Xaml.XamlObjectWriter.WriteEndObject()

           at System.Xaml.XamlWriter.WriteNode(XamlReader reader)

           at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)

           at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter)

           at System.Windows.SystemResources.ResourceDictionaries.LoadDictionary(Assembly assembly, String assemblyName, String resourceName, Boolean isTraceEnabled)

           at System.Windows.SystemResources.ResourceDictionaries.LoadGenericDictionary(Boolean isTraceEnabled)

           at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)

           at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)

           at System.Windows.SystemResources.FindResourceInternal(Object key)

           at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)

           at System.Windows.FrameworkElement.UpdateThemeStyleProperty()

           at System.Windows.FrameworkElement.OnInitialized(EventArgs e)

           at System.Windows.FrameworkElement.TryFireInitialized()

           at System.Windows.FrameworkElement.EndInit()

           at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)

           at System.Xaml.XamlObjectWriter.Logic_EndInit(ObjectWriterContext ctx)

           at System.Xaml.XamlObjectWriter.WriteEndObject()

           at System.Xaml.XamlWriter.WriteNode(XamlReader reader)

           at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)

           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.LoadComponent(Object component, Uri resourceLocator)

           at trial.MainWindow.InitializeComponent() in c:\Users\iqbal\Documents\Visual Studio 2010\Projects\trial\trial\MainWindow.xaml:line 1

           at trial.MainWindow..ctor() in c:\users\iqbal\documents\visual studio 2010\Projects\trial\trial\MainWindow.xaml.cs:line 24

      InnerException: System.Reflection.TargetInvocationException

           HResult=-2146232828

           Message=Exception has been thrown by the target of an invocation.

           Source=mscorlib

           StackTrace:

                at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

                at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

                at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

                at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)

                at System.Xaml.Schema.SafeReflectionInvoker.InvokeMethodCritical(MethodInfo method, Object instance, Object[] args)

                at System.Xaml.Schema.SafeReflectionInvoker.InvokeMethod(MethodInfo method, Object instance, Object[] args)

                at System.Xaml.Schema.XamlMemberInvoker.SetValueSafeCritical(Object instance, Object value)

                at System.Xaml.Schema.XamlMemberInvoker.SetValue(Object instance, Object value)

                at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)

                at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)

                at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.SetValue(Object obj, XamlMember property, Object value)

                at System.Xaml.XamlObjectWriter.SetValue(Object inst, XamlMember property, Object value)

                at System.Xaml.XamlObjectWriter.Logic_ApplyPropertyValue(ObjectWriterContext ctx, XamlMember prop, Object value, Boolean onParent)

                at System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)

                at System.Xaml.XamlObjectWriter.Logic_AssignProvidedValue(ObjectWriterContext ctx)

                at System.Xaml.XamlObjectWriter.WriteEndObject()

                at System.Xaml.XamlWriter.WriteNode(XamlReader reader)

                at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)

                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 MS.Internal.AppModel.AppModelKnownContentFactory.BamlConverter(Stream stream, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)

                at MS.Internal.AppModel.MimeObjectFactory.GetObjectAndCloseStream(Stream s, ContentType contentType, Uri baseUri, Boolean canUseTopLevelBrowser, Boolean sandboxExternalContent, Boolean allowAsync, Boolean isJournalNavigation, XamlReader& asyncObjectConverter)

                at System.Windows.ResourceDictionary.set_Source(Uri value)

                at DevExpress.Xpf.Utils.Themes.ResourceDictionaryEx.set_Source(Uri value)

           InnerException: System.AccessViolationException

                HResult=-2147467261

                Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

                InnerException:


    itismeiqbal

    Sunday, December 11, 2016 7:49 AM

All replies

  • Hi itismeiqbal,

    Welcome to the MSDN forum.

    >> The error is thrown when I am using DevExpress 15.2 Components in my code.

    What’s your application type? Please provide the detail information about your application, it will help us to better support your issue, thank you for your understanding.

    About the error message “Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”, please have a look at this.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 13, 2016 6:22 AM
    Moderator
  • HI 

    Iam using WPF based application in Visual Studio 2010. The error occurs when I am using DevExpress 15.2.4 controls.It throws exception at InitializeComponet() as "Access Violation Exception is unhandled   by user code.Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

    Regards,

    Md.Iqbal


    itismeiqbal

    Tuesday, December 13, 2016 2:53 PM
  • Can be everything beside corrupted hardware memory.

    Try however this forum because like you write it is probably not inside Microsoft.

    https://www.devexpress.com/support/


    Success
    Cor

    Tuesday, December 13, 2016 2:57 PM
  • Hi Md.Iqbal,

    Thank you for your update.

    Like Cor said, your issue is about the development of the DevExpress 15.2.4 controls. Since our forum is to discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor, it is better to redirect to the DevExpress support forum for dedicated information, you will get a more professional from there, thank you for your understanding.

    If you have any other issue, please feel free to let me know.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 14, 2016 2:43 AM
    Moderator
  • Hi,

     It seems the problem is not with DevExpress. After little research on google I checked the Enable Unmanaged code debugging in Debug(Project->Debug-> Enable Unmanaged code debugging) option and could debug the code. But  I do not know what I have to do for ASP.NET based code ie I could not find anything like Enable Unmanaged Code in ASP.NET.

    Regards,

    Md.Iqbal


    itismeiqbal

    Friday, December 16, 2016 6:22 PM
  • And by checking Native code in ASP.NET application


    itismeiqbal

    Friday, December 16, 2016 6:37 PM
  • Hi Md.Iqbal,

    Thank you for your update.

    For ASP.NET project, you should go to the Properties-Web tab, and there is the option "Native Code" under Debuggers.

    For the ASP.NET issue, usually we recommend you redirect to this forum: https://forums.asp.net/ for dedicated information, you can get a better support.

    For the WPF issue, please redirect to this appropriate forum: https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf, that can help you to more effectively, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 19, 2016 8:51 AM
    Moderator