.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

WPF XBAP Release Doesn't Throw/Catch Errors

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :WPF
 

On my development box, launching the XBAP in either Debug or Release with Visual Studio 2010... it throws and catches errors just fine.  So I published the app to be hosted on our Win2008 R2 server...  Now here is what is wierd.  On my machine, hitting the published app still throws/catches errors just fine.  But on other users workstations, it just locks up IE for them, no error, no eventvwr message, nothing.

Any ideas?

Thanks a lot!!!

 

*EDIT*

In App.xaml.cs I am catching all unhandled exceptions this way:

  public partial class App : Application
  {
    protected override void OnStartup(StartupEventArgs e)
    {
      Application.Current.DispatcherUnhandledException += AppDispatcherUnhandledException;
      base.OnStartup(e);
    }
    protected void AppDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
    {
      HandleException(e.Exception);
      e.Handled = true;
    }
    protected static void HandleException(Exception ex)
    {
      ErrorWindow errorWindow = new ErrorWindow("Error connecting to servers, please try reloading the page!", ex, false);
      ((Panel)WPFUtilities.GetApplicationLayoutRoot()).Children.Add(errorWindow);
    }
  }



View Complete Post


More Related Resource Links

Add Release-Only try-catch to CLR languages

  
Deploying a software, it's a common practice to encapsulate top-most function calls and/or event handlers with general try-catch blocks to deliver an error description to the user instead of just having him/her see the software exiting unexpectedly when unexpected exceptions occur. Unfortunately, during debugging it is most annoying to reach these log entries or message boxes instead of having Visual Studio halt where the exception occured. At the time of writing it is possible to designate particular exception types to halt the debugger when they are actually thrown. But it becomes a nuisance when there are many exception types to be marked this way. Plus, it becomes contra-productive if there is a scenario when expected exceptions of the marked types occur regularly and "Continue" has to be selected again and again in the debugger. Thus, I'd like to suggest to add a new, Microsoft specific, "try" keyword to all of the CLR languages (plus C++), perhaps something like "__try". This new kind of try should create a try-catch block only when compiling in Release mode. (This behaviour might apply to other configurations as well. I suppose the Configuration Settings dialog to provide an additional checkbox column to provide an option to select whether a particular configuration will create a try-catch block or not.)   See here for

why doesn't this catch block get reached?

  
I have code for sending an email.  I set a value in my config file for that would throw an smtpfailedrecipient exception.  This exception is being thrown but it isn't reaching the catch block.I get an smtpfailedrecipientexception that is at the send method in the try block.  The error says that the "exception was unhandled by user code".  I don't understand why the catch block isn't being reached.  I thought this would be reached in this situation.  I thought this is what the catch block was for.Can someone please help me understand how to design this better or why this isn't working the way I thought it would? try { client.Send(message); <-- this throws the exception } catch (SmtpFailedRecipientsException ex) { #region Catch logic for (int i = 0; i < ex.InnerExceptions.Length; i++) { SmtpStatusCode status = ex.InnerExceptions[i].StatusCode; if (status == SmtpStatusCode.MailboxBusy || status == SmtpStatusCode.MailboxUnavailable) { lblMessage.Visible = true; lblMessage.Text = "Deli

Errors with calculated columns, the column posts, but doesn't calculate.

  

Hi,

I have a custom list that isn't processing calculated columns anymore.

When I post a calculated column I get one of two error messages...either "SQL Server may not be started" or "The value does not fall within the expected range".  I've noticed the sql message before but the changes are made and calculations in the past have worked ok.  Now that the "value" error is cropping up it's quit calculating the columns.

i.e. I open a calculated column, simply have it reference a numeric field (=[MyNumberField]).  When I hit ok I get one of the two error messages.  When I look at the value of the calculated column it's blank.

Any references to articles, etc. would be helpful.  There are 406 columns in this list...

Best Regards,

S'


PresentationHost.exe (XBAP) throw error: C Run-Time Error R6034

  

Hello,

we are hosting one of our WPF (.NET 3.5 SP1) components within XBAP and thus it delivered through browser (explorer 8.0) to client.
Some time clients (running explorer) receive error and this error thrown by presentetionhost.exe. The error is: C Run-Time Error R6034.
We looked the error in forums and it appears related to manifest. But manifest exists for that WPF/XBAP application. Furthermore, the error does not occurs always only sometime and it not consistent it cannot be recreated on same machine for same scenario.
Cleaning online app cache with mage.exe -cc does not resolve issue it continue to appear occasionally.

Some comment:
1. Sometime application continues working after error box closed, but sometime it crushes.
2. May be it is not relevant but, the application accessing server side with WCF, but no error in this area.
3. I read another thread of this forum: Deploying WPF app - runtime error R6034 (social.msdn.microsoft.com/Forums/?en-US/wpf/thread/233fee41-6cf9-40cd?-bf39-66ddade11746)
 and there the sxstrace tool in use, which in my case is not possible due XP OS.

Does someone have ideas how to get rid of the error?

Thanks, Pavel


throw and catch exception handling

  

Hi,

iam inserting record in three tables in a database, iam using begin trans , commit transaction and rollback,

i want to use throw method, if  any value insert wrong, pls correct me, i want to throw the error and

its go to rollback

running = false;
                        int updaterec = DBmgr.ExecuteNonQuery(CommandType.Text, "update ASArrivedcontainer set billgen ='Y' where billgen ='y' and acontinerid in ("+SelValues+")");
                        if (updaterec > 0)
                        {
                            running = true;
                            DataSet BillContainerDetails = BillingDetails();
         

Abort() method of wcf client proxy doesn't release session after catching FaultException

  

Hello,

I have created a simple wcf service hosted in IIS and wcf client and figured out that when u catch a FaultException from the wcf service and then call client.Abort() to release the session (as the microsoft samples said) it doesn't release the session and hangs up on the 11th call.

Here is example:

Wcf Service:

[ServiceContract]   
public interface IService1 
{ 
    [OperationContract] 
    string GetData(int value); 
} 
 
 
public class Service1 : <

Abort() method of wcf client proxy doesn't release session after catching FaultException

  

Hello,

I have created a simple wcf service hosted in IIS and wcf client and figured out that when u catch a FaultException from the wcf service and then call client.Abort() to release the session (as the microsoft samples said) it doesn't release the session and hangs up on the 11th call.

Here is example:

Wcf Service:

[ServiceContract]   
public interface IService1 
{ 
    [OperationContract] 
    string GetData(int value); 
} 
 
 
public class Service1 : <

how to catch certificate authentication and authorization errors in client

  

How can i know at client side that my request to wcf service(with certificate authentication over nettcp) has failed because of authentication or authorization.

i think authentication can fail if the certificate is not a valid certificate(ie date has expired). For authorization i have implemented ServcieAuthorizationmanger and returning true/false. how wcf will transfer this to authrization error.

Regards


singhhome

Code contracts replacing try/catch throw pattern?

  
I have started reading about the code contracts (design by contract) that's new in the .NET framework 4 which you can implement using System.Diagnostics.Contracts assembly.  I'm still trying to wrap my head around this concept.  Does this in some way replace the try/catch pattern?   I'm not seeing the value in this yet, although I'm sure there is one.

CATCH Distributed Stored Procedure Errors raised

  

As per msdn article, http://msdn.microsoft.com/en-us/library/ms191515.aspx

The Sql server does not catch errors lesser than 20, raised by remote procedure call.

For Example :

Procedure in Remote Server:

CREATE PROCEDURE MyProc

AS

BEGIn

 RAISERROR('My Error', 16, 1)

END

 

Local Computer Call:

 

BEGIN TRY

EXEC MyRemoteLinkedServer.dbo.MyProc

END TRY

BEGIn CATCH

 PRINT 'Yes I Caught'

END CATCH

 

--The Above Code does not catch the error raised, which is correct as per msdn documentation. However,

 

CREATE TABLE #T

(

A int

)

BEGIN TRY

INSERT #T

EXEC MyRemoteLinkedServer.dbo.MyProc

END TRY

BEGIn CATCH

PRINT 'Yes I Caught'

PRINT ERROR_MESSAGE()

END CATCH

 

The above code catches the error raised by the Remote procedure. What is the reason behind the same?

 


SQL Server 2005 Try and Catch Exception Handling

  
I'm pretty excited to see that there is some real error handling for T-SQL code in SQL Server 2005. It's pretty painful to have your wonderfully architected .NET solution tainted by less-than-VBScript error handling for stored procedures in the database. The big difference being the addition of TRY..CATCH blocks. Let's take a look:

Beginner: this doesn't make sense to me

  

Do you need and "empty" script tag in the head to run scripts that are in the body?  Also, can you run JQuery scripts if they're in the <head> tag?  The first sample only works if the JQuery script is in the form (and body) tag, not in the head - even if I add $(document).ready(function() { });

This works

<head runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" />
<script type="text/javascript">
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="">Here is a link</a>
</div>
<script type="text/javascript">
$('a').click(function () {
alert("you clicked me!");
});
</script>
</form>
</body>
</html>

 

This doesn't work.  Notice I removed the second <script> tag from the head

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="serve

How can I be sure that my entire project is up-to-date and free of errors in VS2010?

  

Seems like a stupid question, but I will go to Build > Build Solution many many times and the build will succeed many many times, then I will put in a minor syntax error and the build will fail, BUT the build will not fail because of the minor syntax error; it will fail because of an unresolved type that I put in about twenty compiles ago. And then I will fix the minor syntax eror, and the compiler will still complain about the unresolved type. Here is my code:

<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<html>
<body>
  <form runat="server">
  Hello World!!  
</form>
</body>
</html>

Pretty simple, really. I go to Buld > Build WebApplication1 and it runs OK. Now, if I put in a minor syntax error, such as substitute "forrrrrrrm" for "form" and then try to Build Solution, it complains not about the misspelled word, but about the FreeTextBox. And then if I correct the misspelled wird, it still complains about the FreeTextBox. Which leads me to believe that Building the Solution does not check absolutely 100% everything that needs to be checked. Is there a more thorough way of compiling a program that I need to use?


XBAP Security

  

We have a small XBAP file upload app that we are having trouble deploying. We were getting security errors when we were pushing this application that we don't get when running in our development environments on our machines. We gave the XBAP app full permissions and still got errors. Then we created a personal certificate and were able to get this to work. But that means we have to load a client side certificate for each and every machine that wants to run this which is ridiculous. Does anyone have a solution for this?


reader.getordinal("column_may_not_exist") how to catch the exception?

  

hi,

would any body please help me to catch the exception if the column doesnot exist as my table columns are not static.

sometimes its throwing me indexoutofrange exception as the column doesnot exist

thanks for the help guys


Word Automation - Multiple DCOM Errors/Behavior

  
Before I get started, I already know that Microsoft does not support and highly discourages server-based MS Office automation.  I've read a multitude of posts and smarmy "*wink*, here's a link" replies, so I'm looking for actual help here, not condescending reprimands.

That notwithstanding, here is my problem.  I have developed a simple method that will open a local Word document, modify some header information, and then save the document as a new file.  As expected, it works great as a console/windows app, but as soon as I went to ASP.NET, DCOM jacked my world up when accessing the app remotely from a different domain account (that has access to the ASP.NET app.  For reference, my method is shown below:

  

1    public static string ModifyAndSaveBuildDocument(string localFilePath, BuildDocumentType docType, string buildNumber, DateTime buildDate, string projectName)
2            {
3                try
4                {
5                    ProjectConfiguration config = (ProjectConfiguration)ConfigurationManager.GetSection("ProjectConfiguration");
6    

{ End Bracket }: Don't Be Afraid To Throw Away Your Work

  

With today's processing power at your disposal, Josh Phillips recommends speculative computation-performing operations ahead of time even if you may never need the results.

Josh Phillips

MSDN Magazine October 2008


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend