I get Visual Studio crashing everytime I add a Nuget Reference. It feels like a BUG.
It was reported to the Developer Community (beta) site: https://developercommunity.visualstudio.com/content/problem/6782/manage-nuget-packages-crashes-vs2017rc.html
It states it was fixed, so the exact root cause of this must be different:
The problem looks like it existed back in 2015 but no answers: Nuget Package Manager crashes when clicking "Manage nuget packages for solution" Visual Studio 2015
Its so annoying I have to use the Console to install packages or edit the packages.config file manually and then restore the packages. Not Happy - does anyone have a solution?
Specs
Win7 x64
Microsoft Visual Studio Enterprise 2017
Version 15.2 (26430.6) Release
VisualStudio.15.Release/15.2.0+26430.6
Microsoft .NET Framework v 4.7.02053
Installed Version: Enterprise
.....
NuGet Package Manager 4.2.0
Event Log:
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.UnauthorizedAccessException
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.Shell.Settings.ShellWritableSettingsStore.CreateCollection(String collectionPath)
at Microsoft.VisualStudio.PlatformUI.CategoryMRUItems.SaveItems(WritableSettingsStore store)
at Microsoft.VisualStudio.PlatformUI.MRUItemsStoreService.AddMRUItem(Guid& guidCategory, String lpszItem)
at Microsoft.VisualStudio.PlatformUI.MruItemsStoreServiceDecorator.AddMRUItem(Guid& guidCategory, String lpszItem)
at Microsoft.VisualStudio.Platform.WindowManagement.WindowSearchHost.Microsoft.VisualStudio.Platform.WindowManagement.IWindowSearchEventsHandler.OnAddMRUItem(String searchedText)
at Microsoft.VisualStudio.Platform.WindowManagement.WindowSearchDataSource.OnAddMRUItem(String searchedText)
at Microsoft.VisualStudio.PlatformUI.SearchControlDataSource.AddMRUItemAction(GelDependencyObject datasource, Object parameter)
at Microsoft.Internal.VisualStudio.PlatformUI.GelDependencyObject.Invoke(GelVerb descriptor, Object param)
at Microsoft.Internal.VisualStudio.PlatformUI.GelDependencyObject.Invoke(String verb, Object param)
at Microsoft.Internal.VisualStudio.PlatformUI.GelDependencyObject.Invoke(String verb, Object pvaIn, Object& pvaOut)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32, IntPtr)
at Microsoft.Internal.VisualStudio.PlatformUI.Utilities.Invoke(Microsoft.VisualStudio.Shell.Interop.IVsUIDataSource, System.String, System.Object)
at Microsoft.VisualStudio.PlatformUI.SearchControl.AddToMRUItems(System.String)
at Microsoft.VisualStudio.PlatformUI.SearchControl.SearchBox_LostKeyboardFocus(System.Object, System.Windows.Input.KeyboardFocusChangedEventArgs)
at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.KeyboardDevice.ChangeFocus(System.Windows.DependencyObject, Int32)
at System.Windows.Input.KeyboardDevice.TryChangeFocus(System.Windows.DependencyObject, System.Windows.Input.IKeyboardInputProvider, Boolean, Boolean, Boolean)
at System.Windows.Input.KeyboardDevice.Focus(System.Windows.DependencyObject, Boolean, Boolean, Boolean)
at System.Windows.Input.KeyboardDevice.Focus(System.Windows.IInputElement)
at System.Windows.UIElement.Focus()
at System.Windows.Controls.ListBoxItem.HandleMouseButtonDown(System.Windows.Input.MouseButton)
at System.Windows.Controls.ListBoxItem.OnMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs)
at System.Windows.UIElement.OnMouseLeftButtonDownThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
at System.Windows.UIElement.OnMouseDownThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.ContentElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Interop.HwndSource.InputFilterMessage(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)
Faulting application name: devenv.exe, version: 15.0.26430.6, time stamp: 0x5914d7fe
Faulting module name: KERNELBASE.dll, version: 6.1.7601.23807, time stamp: 0x5915f98e
Exception code: 0xe0434352
Fault offset: 0x0000c54f
Faulting process id: 0xf48
Faulting application start time: 0x01d2fb77b5f33dcc
Faulting application path: C:\Program Files x86\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe
Faulting module path: C:\WINDOWS\syswow64\KERNELBASE.dll
Report Id: f949036c-676b-11e7-8422-3417ebddc764
Error Handler Exception: System.ServiceModel.CommunicationException: There was an error reading from the pipe: Unrecognized error 109 (0x6d). ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: There was an error reading from the pipe: Unrecognized error 109 (0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: Unrecognized error 109 (0x6d).
at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ConnectionStream.EndRead(IAsyncResult asyncResult)
at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
--- End of inner exception stack trace ---
at System.Net.Security.NegotiateStream.EndRead(IAsyncResult asyncResult)
at System.ServiceModel.Channels.StreamConnection.EndRead()
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext) \r\n at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
I used SysInternals Process Monitor to find out that actual ACCESS_DENIED happens when VS attempts to RegCreateKey for a key:
\REGISTRY\A\{4B5F9AD2-BB8B-4CF8-9ACB-201C56F4D086}\Software\Microsoft\VisualStudio\15.0_05fc10d7\MRUItems\{00000000-0000-0000-0000-000000000000}\Items
This key appears to be stored in VS application hive file:
C:\Users\<user name>\AppData\Local\Microsoft\VisualStudio\15.0_05fc10d7\privateregistry.user.bin
I started regedit as admin, loaded hive file into regedit as described:
Launch RegEdit.exe
Select the Computer\HKEY_LOCAL_MACHINE node in the left-hand pane
Select the File | Load Hive... menu item, and load the privateregistry.user.bin
When prompted for a key name, just type in something like "VSRegHive"
This will load the data into a VSRegHive under the HKLM node
Create the 2 absent keys {00000000-0000-0000-0000-000000000000}\Items:
When finished select the VSRegHive and select
File | Unload Hive... , before exiting the RegEdit.exe utility, otherwise
VS will fail to start. Keeping the hive loaded in regedit creates some
sort of lock that prevents DevEnv.exe from launching.
With the 2 missing keys in place VS2017 doesn't crash in NuGet manager.
My VS2017 also crashes in NuGet package manager so I'm unable to add packages to project. Try start VS2017 as Administrator, mine lets me add packages this way, then I restart VS2017 as a normal user.
Related
This question already has answers here:
How to handle AccessViolationException
(5 answers)
Closed 8 years ago.
I have a program that I cannot capture a random error and it crashes the process. I read the article on .NET 4 Framework not capturing System.AccessViolationException errors anymore unless you turn on a switch http://msdn.microsoft.com/en-us/library/dd638517(v=vs.110).aspx but it does not seem to work all the time. Has anyone had experience with this happening and how to capture these errors?
Here is the required switch I put in the the app.config:
<configuration>
<runtime>
<legacyCorruptedStateExceptionsPolicy enabled="true" />
</runtime>
...
Here is the error report:
Log Name: Application
Source: .NET Runtime
Date: 8/19/2014 4:02:50 PM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: Test.local
Description:
Application: mainproc.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at ADODB.RecordsetClass.Open(System.Object, System.Object, ADODB.CursorTypeEnum, ADODB.LockTypeEnum, Int32)
at ADODB.RecordsetClass.Open(System.Object, System.Object, ADODB.CursorTypeEnum, ADODB.LockTypeEnum, Int32)
at CEMain.clsThreadWritebackBatch.
(ADODB.Connection ByRef)
at CEMain.clsThreadWritebackBatch.ProcessBatch()
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 System.Threading.ThreadHelper.ThreadStart()
NEW:
The code below is where I think the problem may have occurred, I would value an opinion.
Try
OpenBackendDatabase(cn, False)
ProcessQueue(cn)
Catch
Trace("ProcessBatch: " & Err.Description, True)
Finally
CloseBackendDatabase(cn)
RaiseEvent FinishedBatch(123)
End Try
So my thought was, if anything bad happens the FINALLY would close the database connection. The CloseBackendDatabase function has its own error handling. But now I am thinking if the "cn" reference was gone (pointer), then calling the ClockBackendDatabase function with a bad "cn" reference could cause an unhandled error? Does that make sense? If so, would this be a possible fix:
Try
OpenBackendDatabase(cn, False)
ProcessQueue(cn)
Catch
Trace("ProcessBatch: " & Err.Description, True)
Finally
Try
CloseBackendDatabase(cn)
Catch
End Try
RaiseEvent FinishedBatch(123)
End Try
The easy fix is to check if the object exists before calling your close function:
If cn IsNot Nothing Then CloseBackendDatabase(cn)
I have a BizTalk 2013 orchestration which I published as a WCF service. The orchestration has a Request-Response port accepting a string and returning an entity which I have defined in a schema.
When I try use the service and pass a string to it, I get the error
http://schemas.microsoft.com/2003/10/Serialization/'> was not expected.
Does anyone have any ideas how to fix this?
Thanks
Full error details below:
xlang/s engine event log entry: Uncaught exception (see the 'inner
exception' below) has suspended an instance of service
'CAA.POC.ESB.BizTalk.Orchestrations.RetrieveAllCases(c408d4a7-3795-f6c7-dc95-c02edfe00740)'.
The service instance will remain suspended until administratively
resumed or terminated. If resumed the instance will continue from its
last persisted state and may re-throw the same unexpected exception.
InstanceId: 6b9cbf6a-2a63-4401-b3a1-05a870da963c Shape name:
ConstructCases ShapeId: 189c5a7f-2306-49dc-bd07-8430e638ba45 Exception
thrown from: segment 1, progress 7 Inner exception: There is an error
in XML document (1, 2).
Exception type: InvalidOperationException Source: System.Xml Target Site: System.Object Deserialize(System.Xml.XmlReader,
System.String, System.Xml.Serialization.XmlDeserializationEvents) The
following is a stack trace that identifies the location where the
exception occured
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader
textReader) at Microsoft.XLANGs.Core.Value.GetObject(Type t) at
Microsoft.XLANGs.Core.Value.RetrieveAs(Type t) at
Microsoft.XLANGs.Core.Part.ProtectedRetrieveAs(Type t) at
Microsoft.XLANGs.Core.Part.RetrieveAs(Type t) at
CAA.POC.ESB.BizTalk.Orchestrations.System_String.get_TypedValue()
at
CAA.POC.ESB.BizTalk.Orchestrations.RetrieveAllCases.segment1(StopConditions
stopOn) at
Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp) Additional error information:
<string xmlns='http://schemas.microsoft.com/2003/10/Serialization/'> was not
expected.
Exception type: InvalidOperationException Source: System.Xml Target Site: System.Object Read_string() The following is a stack
trace that identifies the location where the exception occured
at
System.Xml.Serialization.XmlSerializationPrimitiveReader.Read_string()
at
System.Xml.Serialization.XmlSerializer.DeserializePrimitive(XmlReader
xmlReader, XmlDeserializationEvents events) at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
I am getting the following error intermittently on one of our build environments (not on my local machine) - ignore the NH version - I compiled the assembly form source. The app pool is then restarted in iis. I cannot find out where this is originating from. Any ideas?
An unhandled exception occurred and the process was terminated.
Application ID: DefaultDomain
Process ID: 2428
Exception: System.Runtime.Serialization.SerializationException
Message: Unable to find assembly 'NHibernate.Search, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
StackTrace: at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.AppDomain.Deserialize(Byte[] blob)
at System.AppDomain.UnmarshalObject(Byte[] blob)
I am developing an app in Windows 8 (XAML).
The application runs fine on local machine, however when I create a package in Release Mode and test the app, it crashes.
I saw the application log in my computer and found this error
Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException
Stack:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.WinRTSynchronizationContext+Invoker.b__0(System.Object)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(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.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Note: This is a solved problem, but I just spend 4 hours at this issue, so I wanted to share the solution.
When I attempt to access a WCF service, the service never responds, and the event log shows the following:
An unhandled exception occurred and
the process was terminated.
Application ID: DefaultDomain
Process ID: 3180
Exception:
System.Runtime.Serialization.SerializationException
Message: Unable to find assembly
'System.Data.SQLite, Version=1.0.66.0,
Culture=neutral,
PublicKeyToken=db937bc2d44ff139'.
StackTrace: at
System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo
assemblyInfo, String name) at
System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String
objectName, String[] memberNames,
BinaryTypeEnum[] binaryTypeEnumA,
Object[] typeInformationA, Int32[]
memberAssemIds, ObjectReader
objectReader, Int32 objectId,
BinaryAssemblyInfo assemblyInfo,
SizedArray assemIdToAssemblyTable)
at
System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped
record) at
System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum
binaryHeaderEnum) at
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser,
Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage
methodCallMessage) at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler
handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage
methodCallMessage) at
System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream
stm) at
System.AppDomain.Deserialize(Byte[]
blob) at
System.AppDomain.UnmarshalObject(Byte[]
blob)
Solution
In my case, the problem ended up being a simple incorrect database path. However, the error message in no way reflects the actual cause, so YMMV.
The reason the "bad connection string" exception didn't make it to the event log seems related to this KB article. If the connection string isn't your problem, then your best course may be to follow the steps in this article, which will cause IIS to write exceptions to the event log.