This project is read-only.

Exception while trying to run in debug

Feb 27, 2009 at 9:45 AM
Hi Josh!

I retrieved your glorious code for two reasons :
-MVVM pattern
-Trying to support non-windowed application

But when I build and launch it in VS2008, an AccessViolationException spits at my face, and screams about something like trying to read or write portected memory...
Weirdly, the exception stack differs from time to time:

It can be:
   à MS.Win32.UnsafeNativeMethods.WTSRegisterSessionNotification(IntPtr hwnd, UInt32 dwFlags)
   à System.Windows.Interop.HwndTarget.set_UsesPerPixelOpacity(Boolean value)
   à System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters)
   à System.Windows.Interop.HwndSource..ctor(HwndSourceParameters parameters)
   à System.Windows.Window.CreateSourceWindowImpl()
   à System.Windows.Window.ShowHelper(Object booleanBox)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   à System.Windows.Threading.DispatcherOperation.InvokeImpl()
   à System.Threading.ExecutionContext.runTryCode(Object userData)
   à System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Windows.Threading.DispatcherOperation.Invoke()
   à System.Windows.Threading.Dispatcher.ProcessQueue()
   à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   à System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   à MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   à System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
   à System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   à System.Windows.Application.RunInternal(Window window)
   à CrackNET.App.Main() dans C:\Users\roubachof\Documents\Visual Studio 2008\Projects\Sources Applications Non RTE\CrackNET\CrackNET\obj\Debug\App.g.cs:ligne 0
   à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Threading.ThreadHelper.ThreadStart()

Or:
   à System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
   à System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
   à System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
   à System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   à System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   à System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   à System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   à System.Windows.FrameworkElement.ApplyTemplate()
   à System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   à System.Windows.UIElement.Measure(Size availableSize)
   à System.Windows.Interop.HwndSource.SetLayoutSize()
   à System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   à System.Windows.Window.SetRootVisual()
   à System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
   à System.Windows.Window.CreateSourceWindowImpl()
   à System.Windows.Window.ShowHelper(Object booleanBox)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   à System.Windows.Threading.DispatcherOperation.InvokeImpl()
   à System.Threading.ExecutionContext.runTryCode(Object userData)
   à System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Windows.Threading.DispatcherOperation.Invoke()
   à System.Windows.Threading.Dispatcher.ProcessQueue()
   à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   à System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   à MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   à System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
   à System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   à System.Windows.Application.RunInternal(Window window)
   à CrackNET.App.Main() dans C:\Users\roubachof\Documents\Visual Studio 2008\Projects\Sources Applications Non RTE\CrackNET\CrackNET\obj\Debug\App.g.cs:ligne 0
   à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Threading.ThreadHelper.ThreadStart()

with inner exception:
   à System.Reflection.Assembly._GetFullName()
   à System.Reflection.Assembly.get_FullName()
   à System.Windows.Markup.BamlMapTable.GetKnownTypeIdFromType(Type type)
   à System.Windows.Markup.BamlRecordReader.ReadContentPropertyRecord(BamlContentPropertyRecord bamlContentPropertyRecord)
   à System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)

I'm working on Vista64 with 3.5 SP1.
If you have any idea...

Thanks !
Feb 27, 2009 at 12:46 PM
Hi roubachof,

This is a strange issue!  Have you compiled Crack.NET with the x64 compiler switch turned on?  There is an issue with the interop code that requires you to compile the application for differently a 64-bit OS.  For more information about this, check out the other discussion threads.

If that is not the problem, then I am not sure what to tell you.  Can you send me a simple demo project that reproduces this?

Thanks,
Josh