473,382 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Could you give me a solution?

Hi All,



In my UI Layer I am raising the Exception Divisible by Zero.

In Catch block of UI Layer I am calling the Business layer function to write this exception into Event Viewer

After the Exception writes into the Event viewer the control come back to UI Layer of Catch block.

When I am getting the error like “Exception has been thrown by the target of an invocation.”



If you know the solution for this problem, please reply to this mail.



I am using

.Net 2.0, Application Block 2.0 and XP Professional



See the Following Code



Business Layer



public interface ICommonFunctions

{

void LogErrInToFile(Exception ex);

}



public class CommonFunctions : MarshalByRefObject, ICommonFunctions

{

public bool LogErrInToFile(Exception ex)

{



bool boolError = ExceptionPolicy.HandleException(ex, "ExceptionPolicy");

}

}



UI Layer

try

{

int i = 1;

int j = 0;

int k = i / j;

}

catch (Exception ex)

{

bool boolError = objCF.LogErrInToFile(ex); //Error occurs after the control comes from Business layer.

}

finally

{

}



Error

System.Reflection.TargetInvocationException was unhandled

Message="Exception has been thrown by the target of an invocation."

Source="mscorlib"

StackTrace:

Server stack trace:

at System.RuntimeMethodHandle._SerializationInvoke(Ob ject target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)

at System.RuntimeMethodHandle.SerializationInvoke(Obj ect target, SignatureStruct declaringTypeSig, SerializationInfo info, StreamingContext context)

at System.Reflection.RuntimeConstructorInfo.Serializa tionInvoke(Object target, SerializationInfo info, StreamingContext context)

at System.Runtime.Serialization.ObjectManager.Complet eISerializableObject(Object obj, SerializationInfo info, StreamingContext context)

at System.Runtime.Serialization.ObjectManager.FixupSp ecialObject(ObjectHolder holder)

at System.Runtime.Serialization.ObjectManager.DoFixup s()

at System.Runtime.Serialization.Formatters.Soap.Objec tReader.Deserialize(HeaderHandler handler, ISerParser serParser)

at System.Runtime.Serialization.Formatters.Soap.SoapF ormatter.Deserialize(Stream serializationStream, HeaderHandler handler)

at System.Runtime.Remoting.Channels.CoreChannel.Deser ializeSoapResponseMessage(Stream inputStream, IMessage requestMsg, Header[] h, Boolean bStrictBinding)

at System.Runtime.Remoting.Channels.SoapClientFormatt erSink.DeserializeMessage(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)

at System.Runtime.Remoting.Channels.SoapClientFormatt erSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData& msgData, Int32 type)

at Thames.OSS.Interfaces.ICommonFunctions.LogErrInToF ile(Exception ex)

at OSSThickClientProject.ProfileManagement.profileMan agement_Load(Object sender, EventArgs e) in D:\GISADS3\OSSThickClientProject\ProfileManagement .cs:line 63

at System.Windows.Forms.Form.OnLoad(EventArgs e)

at System.Windows.Forms.Form.OnCreateControl()

at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

at System.Windows.Forms.Control.CreateControl()

at System.Windows.Forms.Control.WmShowWindow(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)

at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)

at System.Windows.Forms.Form.WmShowWindow(Message& m)

at System.Windows.Forms.Form.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)

at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

at System.Windows.Forms.UnsafeNativeMethods.SendMessa ge(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)

at System.Windows.Forms.Form.SetVisibleCore(Boolean value)

at System.Windows.Forms.Control.set_Visible(Boolean value)

at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.Run(Form mainForm)

at OSSThickClientProject.Program.Main() in D:\GISADS3\OSSThickClientProject\Program.cs:line 20

at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context( Object state)

at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

Thanks in advance.

Regards

Rajaram.
Jul 14 '06 #1
2 2899
When I get an Exception from UI layer... I send this exception to Business layer here it writes the exception into Event view. After this I am getting the error "Exception has been thrown by the target of an invocation." when the control comes back from Business layer to UI layer. Please help me....
Jul 14 '06 #2
Enyi
38
I'm not sure myself. See if this webpage can explain anything useful. Looks like something about inner exceptions.

http://www.geekpedia.com/Question70_...nvocation.html
Jul 14 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Rene | last post by:
Hi, I'm spend many hour to fix this problem, read many articles about it but no article gave a solution. To isolate the problem I've created in IIS6 (WServer2003) a virtual directory test to...
3
by: MarcJessome | last post by:
Hi, I was wondering if someone could help me through learning C++. I've tried learning before, but I find I would work better if I had someone that could help explain a few things to me. Im using...
10
by: Ray Z | last post by:
hi, there I build a Class Library, I write a class A to implement interface IA. The problem is when I give the dll file to others, thet can get all information about not only IA, but also A. They...
3
by: mrwoopey | last post by:
Hi, I am using the example "Authenticate against the Active Directory by Using Forms Authentication and Visual Basic .NET": http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340 ...
6
by: jake | last post by:
How do you get or save a file from/to a client (button on web page) once they are authenticated? The client could be Mac, Linux or Windows. Can I do it all with IIS and ASP.NET?
4
by: Sven-Torben Janus | last post by:
I'm running an ASP.NET webapplication on a Windows 2000 Server SP4 machine with .Net Framework 1.0 installed. The ASP.Net application uses impersonation (windows domain account). This is needed...
1
by: heromull | last post by:
Here's what we did to resolve the Could not load type 'Namespace.Global' issue... the setup: asp.net app, iis 6, home directory is a share located on another computer. our solution: ymmv...
5
by: Verane | last post by:
Hi, I have read the thread named "Could not copy temporary files to the output directory" on this newsgroup. And I have the same symptoms on my machine. But I didn't find any solution suitable for...
2
by: Nitin M | last post by:
Hi All, I am trying to call a web service on the same machine (as the client code) through a dotnet client and I get the following error. "The underlying connection was closed: The proxy name...
9
by: Kernel Bling | last post by:
Hi Everyone, This Saturday the stage was set. The problem simply could not go on existing -- it had to be solved. Many hours, articles, compilations and frustrations later I still did not find...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.