My installer program is crashing due to exception: 0xE0434352 - visual-studio

I used Visual studio installshield to create an installation program and sent it to the server. When I tried to run the application on the server I get the following Microsoft windows message:
{” Myapplication has stopped working”
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available”}
When I click the Debug button.
I get the following exception:
[There is an unhandled win32 exception occurred in Myapplication.exe [6620]]
When I click debug using the selected debugger which is New instance of Visual Studio 2008
Microsoft visual studio threw the following exception:
[Unhandled exception at 0x76effd1e in Myapplication.exe: 0xE0434352: 0xe0434352]
Can someone help, please? I have no clue what any of this exception and error means.

I found the resource's to solving this exception here # stackoverflow, as suggested by #kynrek or rephrase by #kynrek,
By adding a handler for “AppDomain.CurrentDomain.UnhandledException as described here #
http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception”
#kynrek should have credit for this answer.
Public Class Form1
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
Try
Catch ex As Exception
ErrMsgTextBox1.Text = (ex.Message)
End Try
Private Sub MyHandler(sender As Object, args As UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject, Exception)
ErrMsgTextBox1.Text = (e.Message)
End Sub 'MyUnhandledExceptionEventHandler
End Class

Related

visual studio 2015 c# not break on unhandled exception in formload method [duplicate]

I just came across odd behavior with exception handling in .Net. (I'm using C# in MS Visual Studio 2008, but one question I saw here seemed to imply that what I see is true throughout the .Net world.) I am writing a plain WinForm application. I am intentionally causing an unhandled exception to be thrown inside a form_load event handler, outside of any try block. I get no notification. If an unhandled exception occurs in a normal method, a message pops up telling me that the exception happened, and giving me some information about the problem. But in the handler, the code just quietly exits the function without letting anybody know that it happened. If I add a try/catch block, the exception is caught as expected.
Is it true that this behavior happens in all event handlers? And is this expected behavior? And if so, is it because there is too much danger of bad things happening if an event handler unexpectedly stops?
Whether inside or outside VS, this behavior occurs when there is a debugger attached to the process. However, being a debug version makes no difference. If running outside VS without a debugger attached, the unhandled exception will fire up.
You can check
Why the form load can't catch exception? , and
VS2010 does not show unhandled exception message in a WinForms Application on a 64-bit version of Windows , for possible solutions.
EDIT: This behavior is only specific to the form_load event handler, as far as I know.

Error starting Visual Studio 2012

I'm getting an error message every time I start Visual Studio. Since I'm also seeing some unexplained behavior in my project, I'd like to resolve this issue.
Error Message
An exception has been encountered. This may be caused by an extension.
You can get more information by examining the file 'C:\Users\Jonathan\AppData\Roaming\Microsoft\VisualStudio\11.0\ActivityLog.xml'.
When I look at the log file, I find two exceptions:
Error 1
Exception Type : System.Windows.Markup.XamlParseException
Exception Message : Provide value on 'System.Windows.StaticResourceExtension' threw an exception.
Exception Stack Trace:
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 SquaredInfinity.VSCommands.UI.Views.DefaultAlertView.InitializeComponent()
at SquaredInfinity.VSCommands.Foundation.Services.VSCUIService.GetDefaultAlertViewModel(String alertMessage, String alertDialogTitle)
at SquaredInfinity.Foundation.Presentation.Services.UIService.GetDefaultAlertViewModel(String alertMessage)
at SquaredInfinity.Foundation.Presentation.Services.UIService.ShowAlert(String message)
at SquaredInfinity.VSCommands.VSCommandsPackage.Initialize()
Exception Data : [EmptyOrNull]
Inner Exception:
Exception Type : System.Exception
Exception Message : Cannot find resource named 'VSC.Button'. Resource names are case sensitive.
Exception Stack Trace: at System.Windows.StaticResourceExtension.ProvideValueInternal(IServiceProvider serviceProvider, Boolean allowDeferredReference)
at System.Windows.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
Exception Data : [EmptyOrNull]
Error 2
System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) The current type, SquaredInfinity.Foundation.Configuration.Services.IConfigurationService, is an interface and cannot be constructed. Are you missing a type mapping?
Resulting in: Resolution of the dependency failed, type = "SquaredInfinity.Foundation.Configuration.Services.IConfigurationService", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The current type, SquaredInfinity.Foundation.Configuration.Services.IConfigurationService, is an interface and cannot be constructed. Are you missing a type mapping?
-----------------------------------------------
At the time of the exception, the container was:
Resolving SquaredInfinity.Foundation.Configuration.Services.IConfigurationService,(none)
Resulting in: An exception occurred while trying to create an instance of type '#Btb.#Rtb'.
Resulting in: Cannot activate part '#Btb.#Rtb'.
Element: #Btb.#Rtb --> #Btb.#Rtb
Resulting in: Cannot get export '#Btb.#Rtb (ContractName="Microsoft.VisualStudio.Text.Classification.IClassifierProvider")' from part '#Btb.#Rtb'.
Element: #Btb.#Rtb (ContractName="Microsoft.VisualStudio.Text.Classification.IClassifierProvider") --> #Btb.#Rtb
at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(CatalogPart part, ExportDefinition export, Boolean isSharedPart)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
at System.ComponentModel.Composition.Primitives.Export.get_Value()
at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export)
at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedLazyOfTM>b__1()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource)
How do I interpret this so that I can figure out the error?
It seems there is something wrong with the VSCommands extension or another plugin. You can try to disable all extensions, restart Visual Studio and re-enable them; sometimes it resolves such issue.
Another thing you can try, is to run Visual Studio as administrator, because this error can occur if there are not sufficient permissions to access some resources (it was a bug in older releases of Visual Studio).
Your last painful resort will be a clean re-installation.
Just reinstall latest Web Essentials 5/5/2013. It resolves the problem. No need to uninstall or disable anything, just run setup again and you are done.
http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6
Fixed by deleting the following folder:
C:\Users{username}\AppData\Local\Microsoft\VisualStudio{version-number}\ComponentModelCache
This error starts after installing Visual Studio 2012 Update 2. Apparently the Web Tools and Web Essentials 2012 extensions have a conflict -- they both try to register some of the same components, which generates this exception.
Additionally, it appears the automatic update notification for one or both of these extensions is broken when VS 2012 Update 2 is installed, because though the extensions have been updated to resolve the conflict, you aren't notified that an update exists.
The solution is to remove both extensions, then reinstall them.
For more information about this, see http://madskristensen.net/post/web-tools-20122-and-web-essentials.
I was getting this same error. I noticed that the NuGet Package Manager extension had an update. After installing this update, the error went away.
Make sure all available updates are applied. To check if there are any updates available open Tools > Extensions and Updates. In the "Extensions and Updates" dialog, expand the "Updates" node in the left pane. Install any updates that may be available and restart Visual Studio 2012.
For all people having this problem:
Open Visual Studio 2012, but don't load any solutions / projects
Open Extensions and Updates from the Tools menu
Disable Web Essentials 2012
Delete the .suo file for your solution
Open the solution in Visual Studio
See that it loads and Visual Studio doesn't crash
Enable Web Essentials 2012
Restart Visual Studio 2012 and reload your solution.
Happy times!
Source
All you need to resolve the above stated issue is to delete the *.suo file for the project and Visual Studio. I had the same issue.
I was also getting the same error:
An exception has been encountered. This may be caused by an extension.
You can get more information by examining the file 'C:\Users\ . . .
\VisualStudio\11.0\ActivityLog.xml'
Reason:
I had uninstalled some of the SQL files from the control panel. Only after that did I start to get this error, but I was not sure which service I had uninstalled.
Solution:
I downloaded the SDK for Visual Studio 2012 and installed/restarted Visual Studio, then it worked fine.

Prevent Visual Studio from breaking when throwing exceptions

I test the exceptions interception, so, I don't need that Visual Studio breaks on thinkgs like thrown new NullReferenceException("myVar").
I have the following under Debug=>Exceptions
however, VS breaks on the exceptions. What should I do?
PS.
for the application unhandled exception, I "catch" them using the Application.UnhandledException as in the the following:
''' <summary>Occurs when the application encounters an unhandled exception.</summary> '
Private Sub Application_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
Dim message As String = String.Format("An application UnhandledException were thrown.{1}The application will now terminate.{1}'{0}'{1}{1}StackTrace:{1}{2}", e.Exception.Message, Environment.NewLine, e.Exception.StackTrace)
MessageBox.Show(message)
End Sub
I had same problem when I started using VS2010. I have unit tests, which expect exceptions, and I throw exceptions from my functions. These exceptions are supposed to be handled by the user of my library. In Debug->Exceptions dialog, I unchecked check box under User-Unhandled column for Common Language Runtime Exceptions, and VS stopped breaking on these exceptions. By the way, I don't see second column in the dialog you attached here.
If you throw an exception that is not handled anywhere in your code, Visual Studio is going to break. It doesn't have any other choice: there was an unhandled exception. Outside of Visual Studio, the application would show an error message and inform the user that an unhandled exception occurred.
The options you see in the Debug -> Exceptions dialog only allow you to configure whether Visual Studio breaks on all exceptions, including those that are later handled in your code. These are often referred to as "first-chance" exceptions.
Beyond that, you should never throw a NullReferenceException yourself; this is a runtime exception that is reserved for the runtime framework. Instead, you should throw an ArgumentNullException.
The below method works for me in Visual Studio 2015 (a similar process may work for VS2010).
Taken from the Visual Studio documentation on managing exceptions with the debugger:
In the Exception Settings window, open the context menu by right-clicking in window and then selecting Show Columns. (If you have turned off Just My Code, you will not see this command.)
You should see a second column named Additional Actions. This column displays Continue when unhandled by user code on specific exceptions, meaning that the debugger does not break if that exception is not handled in user code but is handled in external code.
You can change this setting either for a particular exception (select the exception, right-click, and select/deselect Continue when Unhandled in User Code) or for an entire category of exceptions (for example, all the Common Language Runtime exceptions).

Visual Studio 2010 UnhandledException, ThreadException error handling?

In my code I had an error that was catched by following exceptions while program was running. However when I was running program in Visual Studio when the error was happening application was simply exiting without any error (other errors usually bring me to the problematic line).
if (ApplicationDeployment.IsNetworkDeployed) {
AppDomain.CurrentDomain.UnhandledException += currentDomainUnhandledException;
Application.ThreadException += applicationThreadException;
}
Of course if i remove the if i get this exception handling done by my methods which simply uses MessageBox to show the error. Is there a way to force Visual Studio to catch this error like it catches other types of errors?
Only by using Debug + Exceptions, Thrown checkbox. That makes the debugger stop on the "first chance". At the point the exception is thrown. You typically want to do this:
if (!System.Diagnostics.Debugger.IsAttached) {
// Subscribe the events
//...
}
Note that this already works that way for Application.ThreadException, Winforms already avoids catching exceptions if it sees a debugger. For the exact same reason.

How to temporarily deactivate all try / catch blocks?

Is there a possibility to deactivate / activate all try catch blocks in the whole project as easy as clicking a button?
I need this for debugging when I don't want the catch block to handle the exception, but instead prefer that VS breaks into the code as if the try catch block was not there.
At the moment I am commenting out the try/catch blocks but this is inefficient.
Environment: VS 2008 with C# as language.
To catch exceptions the moment they're thrown ("first-chance exceptions" in Win32 parlance):
in VS2008: go to Debug, Exceptions...
by VS2015: this has been moved to Debug > Windows > Exception Settings
Then check the box Thrown for Common Language Runtime Exceptions.
There is no way to deactivate try/catch blocks.
However, for debug purposes, if you want to break as soon as a particular type of exception is thrown, you can get Visual Studio to do that (Debug -> Exceptions; select the exception type you're interested in and check the "Thrown" box).
Thought about this today and found an other solution. The advantage of this is that the IDE will stop at the exact point of the occuring exception.
Somewhere globaly defined:
Namespace Global.System
Public Class NeverOccurException
Inherits Exception
End Class
End Namespace
At the beginning of each source code file:
#If DEBUG
Imports CatchAtReleaseException = System.NeverOccurException
#Else
Imports CatchAtReleaseException = System.Exception
#End If
Usage:
'Compiled in DEBUG-Mode the TryCatch is "disabled", because the
'the ALIAS CatchAtReleaseException is set to "NeverOccurException"
'Compiled as RELEASE the TryCatch is "enabled", because the ALIAS
'is set to the regular "System.Exception"
Public Sub SampleSub()
Try
'...
Catch ex As CatchAtReleaseException
End Try
End Sub
Have fun with it,
Greetings,
Ted
If you want to do in the IDE, Debug -> Exceptions is the dialog where you can ask the IDE to break when a specific/category/all exceptions are thrown.
You can change the way Visual Studio breaks when an exception occurs. By default, it breaks on unhandled exceptions. If you go to menu Debug > Exceptions, you can uncheck Common Language Runtime Exceptions and make other changes in the IDE's behavior when exceptions occur. For example, you can have it break on only one kind of exception; there's a long list there.
I have done this on rare occasions when trying to debug.

Resources