2015-06-12 13 views
15

Buduję aplikację WPF, która obecnie ma tylko elementy interfejsu użytkownika. Próbuję użyć klas, które zrobiłem w innym projekcie, importując bibliotekę DLL. Po uruchomieniu aplikacji WPF, Visual Studio wyskakuje to okno w drużynie Explorer:Błąd wewnętrzny podczas pracy z projektem Visual Studio

error message

aplikacja nadal działa, ale nie znam przyczyny tego błędu i co jej skutki. Czy ktokolwiek inny napotkał ten błąd i miał trochę wglądu?

Nie jestem pewien, czy jest to istotne, ale projekt, który importuję, używa NHibernate i Log4Net. Używam również Visual Studio 2013 Express, jeśli ma to coś wspólnego.

UPDATE:

Oto ślad stosu:

at DatabaseUI.DatabaseViewModel..ctor() in c:\Users\andrew\Documents\Visual Studio 2013\Projects\DatabaseUI\DatabaseUI\ViewModels\DatabaseViewModel.cs:line 36 
    at DatabaseUI.MainWindow..ctor() in c:\Users\andrew\Documents\Visual Studio 2013\Projects\DatabaseUI\DatabaseUI\MainWindow.xaml.cs:line 30 
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) 
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) 
    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) 
    at System.Activator.CreateInstance(Type type, Boolean nonPublic) 
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) 
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) 
    at System.Activator.CreateInstance(Type type, Object[] args) 
    at System.Xaml.Schema.SafeReflectionInvoker.CreateInstanceCritical(Type type, Object[] arguments) 
    at System.Xaml.Schema.SafeReflectionInvoker.CreateInstance(Type type, Object[] arguments) 
    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) 
    at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx) 
    at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property) 
    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 System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties) 
    at System.Windows.Application.DoStartup() 
    at System.Windows.Application.<.ctor>b__1(Object unused) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Windows.Threading.DispatcherOperation.Invoke() 
    at System.Windows.Threading.Dispatcher.ProcessQueue() 
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 
    at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 
    at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 
    at System.Windows.Threading.Dispatcher.Run() 
    at System.Windows.Application.RunDispatcher(Object ignore) 
    at System.Windows.Application.RunInternal(Window window) 
    at System.Windows.Application.Run(Window window) 
    at System.Windows.Application.Run() 
    at DatabaseUI.App.Main() in c:\Users\andrew\Documents\Visual Studio 2013\Projects\DatabaseUI\DatabaseUI\obj\Debug\App.g.cs:line 0 
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading.ThreadHelper.ThreadStart() 

UPDATE 2: usunąłem kod ViewModel ponieważ problem ten istniał zanim go stworzył. Mam ten błąd, gdy po raz pierwszy utworzyłem aplikację wpf bez żadnej zawartości. Szukam odpowiedzi, które opisują, co oznacza ten błąd lub podobną sytuację, w której ktoś był w stanie rozwiązać ten problem.

UPDATE 3: Uruchomiłem nowy projekt aplikacji konsolowej i pojawia się ten sam błąd. Ten projekt nie korzysta z żadnych zasobów z wcześniej opisanego projektu, ale oba te projekty używają log4net i nhibernate. Myślę, że jest to problem nhibernate.

AKTUALIZACJA 4: Uruchomiłem nową aplikację konsolową absolutnie nic, a nadal otrzymuję ten błąd. Usunąłem wszystkie odwołania i całą AssemblyInfo.cs, i wciąż nie postępu.

UPDATE 5: Tworzę nową aplikację konsoli C++ i pojawia się ten sam błąd. Nie nhibernate ani nic, co myślałem, że to zepsuło. Zdecydowanie jest coś nie tak z Visual Studio ...

+1

HandyPete, W rozwiązaniu dll można utworzyć tam projekt testowy i utworzyć instancje niektórych klas w tym projekcie. Bądź ciekawy, czy błąd pojawia się w nim po uruchomieniu. To może zapewnić pewien poziom izolacji, w której może wystąpić błąd. – Jim

+1

Ktoś używa odbicia i robi dzikie/złe rzuty. Wszyscy (wszyscy) potrzebujemy pełnego śledzenia stosu. Jest prawie niemożliwe, aby pomóc w/o to. –

+1

@Jim Zacząłem ten projekt od zbudowania aplikacji konsolowej, która zaimplementowała te klasy, następnie wziął te klasy i zrobił bibliotekę dll. Nie spowodowały błędów w aplikacji konsoli, ale to był dobry pomysł, aby spróbować. – Batman

Odpowiedz

0

Dzieje się tak, gdy masz statyczny zasób, w twoim przypadku jest databseviewmodel, który jest inicjowany, a z tego powodu niepowodzenia. Jeśli twój viewmodel wywołuje bazę danych po jej zbudowaniu, to pokaże błąd z powodu niewłaściwej inicjalizacji.

+0

Błąd wystąpił przed utworzeniem modelu widoku – Batman

1

Naprawiłem błąd przez ponowne zainstalowanie Visual Studio. Wciąż zastanawiam się, co poszło nie tak, ale coś głęboko w głębi Visual Studio musiało być uszkodzone. Gdy dowiem się więcej, zaktualizuję tę odpowiedź, aby była bardziej kompletna.

Powiązane problemy