This is a migrated thread and some comments may be shown as answers.

System.AccessViolationException

6 Answers 470 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
BENN
Top achievements
Rank 1
BENN asked on 06 Mar 2018, 05:07 AM

One of our customers in Brazil is experiencing our program crash upon start. He has this problem on 4 different computers. A 5th computer had this problem and after format the problem is gone.

The computers, as much as I understand, have Windows 7 (I assume that all of them have the same OS).

From the Event Viewer, I was able to see the error, and it appears to be coming from your code:

 

Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
   at Telerik.Windows.Controls.RibbonView.Shell.Standard.NativeMethodsHelper+NativeMethods._RegisterClassEx(Telerik.Windows.Controls.RibbonView.Shell.Standard.WNDCLASSEX ByRef)
   at Telerik.Windows.Controls.RibbonView.Shell.Standard.NativeMethodsHelper+NativeMethods.RegisterClassEx(Telerik.Windows.Controls.RibbonView.Shell.Standard.WNDCLASSEX ByRef)
   at Telerik.Windows.Controls.RibbonView.Shell.Standard.MessageWindow..ctor(Telerik.Windows.Controls.RibbonView.Shell.Standard.CS, Telerik.Windows.Controls.RibbonView.Shell.Standard.WS, Telerik.Windows.Controls.RibbonView.Shell.Standard.WS_EX, System.Windows.Rect, System.String, Telerik.Windows.Controls.RibbonView.Shell.Standard.WndProc)
   at Telerik.Windows.Controls.RibbonView.Shell.SystemParameters2.Init()
   at Telerik.Windows.Controls.RibbonView.Shell.SystemParameters2..ctor()
   at Telerik.Windows.Controls.RibbonView.Shell.SystemParameters2.get_Current()
   at Telerik.Windows.Controls.RibbonView.Shell.WindowChrome..ctor()
   at System.Xaml.Schema.XamlTypeInvoker+DefaultCtorXamlActivator.CallCtorDelegate(System.Xaml.Schema.XamlTypeInvoker)
   at System.Xaml.Schema.XamlTypeInvoker+DefaultCtorXamlActivator.CreateInstance(System.Xaml.Schema.XamlTypeInvoker)
   at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(System.Object[])
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(System.Xaml.XamlType, System.Object[])
   at MS.Internal.Xaml.Runtime.PartialTrustTolerantRuntime.CreateInstance(System.Xaml.XamlType, System.Object[])
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(MS.Internal.Xaml.Context.ObjectWriterContext)
   at System.Xaml.XamlObjectWriter.WriteStartMember(System.Xaml.XamlMember)
   at System.Windows.Markup.WpfXamlLoader.TransformNodes(System.Xaml.XamlReader, System.Xaml.XamlObjectWriter, Boolean, Boolean, Boolean, System.Xaml.IXamlLineInfo, System.Xaml.IXamlLineInfoConsumer, MS.Internal.Xaml.Context.XamlContextStack`1<System.Windows.Markup.WpfXamlFrame>, System.Windows.Markup.IStyleConnector)
   at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
   at System.Windows.ResourceDictionary.CreateObject(System.Windows.Baml2006.KeyRecord)
   at System.Windows.ResourceDictionary.OnGettingValue(System.Object, System.Object ByRef, Boolean ByRef)
   at System.Windows.ResourceDictionary.OnGettingValuePrivate(System.Object, System.Object ByRef, Boolean ByRef)
   at System.Windows.ResourceDictionary.GetValueWithoutLock(System.Object, Boolean ByRef)
   at System.Windows.ResourceDictionary.GetValue(System.Object, Boolean ByRef)
   at Telerik.Windows.Controls.RadRibbonWindow..ctor()
   at MyApp.MainWindow..ctor()

Exception Info: System.Windows.Markup.XamlParseException
   at System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)
   at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
   at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
   at System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext)
   at System.Windows.Application.DoStartup()
   at System.Windows.Application.<.ctor>b__1_0(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at MyApp.App.Main()

 

 

As I understand, our software used to work on all, or some of the computers, but then it stopped (might be due to software install, Windows update, or configuration change in Windows).

I already tried uninstalling few Windows updates, and reparing the installed .net framework (4.7.1), but it didn't help.

 

 

Are you familiar with this issue, or know what can cause it?

If so, how can I solve it? (uninstall something, repair some installation, or change some windows configuration).

As I understand from the exception, the error is related to the RibbonWindow, but I'm not sure why it fails. 

 

 

Please help.

Thank.

 

6 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 07 Mar 2018, 02:36 PM
Hi Benn,

We also don't what happens. The exception is very interesting and it comes from a part of the code that uses the win32 API so it is possible that the ribbon window control messes up. However, without reproducing this I cannot tell what is the core reason for this. That's why I would recommend you to open a new support ticket from your telerik.com account and there attach an isolated project demonstrating the error. 

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
BENN
Top achievements
Rank 1
answered on 08 Mar 2018, 05:18 AM

Unfortunately,

This project is huge, and it works fine for thousands of users around the globe, and it fails only for a specific user on 4 different computers, so even if I'm able to supply a small project where it fails to that customer, then it won't fail on yours.

 

As much as I understand, this kind of error can happen if some object was not allocated, and / or windows tries to write to a protected memory area.

The code in the MessageWindow passes a WNDCLASSEX struct to the RegisterClassEx function.

I can only guess that one of the pointers in that struct is 0 because one of the previous steps failed.

 

 

Can you at least instruct me on what to put in your code in order to find out what is wrong?

Where to put logs, and what to log. I'll change your code and re-compile it, so I'll have a small exe that should also fail on the customer's computer.

 

0
Dinko | Tech Support Engineer
Telerik team
answered on 12 Mar 2018, 02:44 PM
Hi Benn,

Without reproducing this behavior on our side we can only guess what could be the reasons behind this behavior.

You can give us more information about this error:
  • You can elaborate more on the set up of the machines (OS, Windows, #32 or #64 etc.) where the application crash?
  • Are you using the latest version of our controls? If not, can you download the latest one and check again if this error appears.
What I can suggest you is to create a memory dump of the exception and send it for further investigation. You can take a look at the following post which could be of help:
Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
BENN
Top achievements
Rank 1
answered on 13 Mar 2018, 04:32 AM

Windows 7 64 bit (Another customer from Brazil, but with Windows 10,  also has a problem, but I did not confirm that it's the same problem, so for now it's only Windows 7 64).

It crashes when the main window is created (which is a RibbonWindow). The window is not yet shown.

0
BENN
Top achievements
Rank 1
answered on 13 Mar 2018, 04:38 AM

The product uses the 2017.Q3 sources, but since I recompile the sources and follow the version changes, then I didn't see any code change that can fix the problem somehow.

I'll try reproducing the problem on their side with a simple app using the latest dlls and create crash dump.

Our program used to work, but then it stopped working on their computer after a windows update or maybe a program that was installed.

I suspected that the following windows update caused the problem (since it caused problems for other users):

https://support.microsoft.com/en-us/help/4074906/typeinitializationexception-or-fileformatexception-error-in-wpf-apps-t

 

but they have uninstalled the update and also ran the Fixit tool and it didn't help.

0
Dinko | Tech Support Engineer
Telerik team
answered on 15 Mar 2018, 02:21 PM
Hi BENN,

I am looking forward to the isolated project which reproduces this exception on your customer's machines. Stil way I could test this project on my side and try to reproduce this exception.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RibbonView and RibbonWindow
Asked by
BENN
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
BENN
Top achievements
Rank 1
Dinko | Tech Support Engineer
Telerik team
Share this question
or