TargetInvocationException on Deployment

I have a weird issue that I'm trying to sort out and I'm wondering if anyone has any similar experiences to give me a lead.

A Windows app I developed runs fine locally, on my notebook (second computer) at home, and on my friend's machine apparently, but when I try to open the file at work to use it to perform an assigned task I get:

An unhandled exception of type
'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

Additional information: Exception has been thrown by the target of an invocation.

I tried to see if I was including files on one machine that I wasn't on another and apparently they use the same stuff. Are there any circumstances where I'd get such an error on one machine and not another?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I believe this is an 'old' bug in the 1.0 Framework, but dunno if it occurs in 1.1 as well. This should be fixed when installing the latest service packs for the .NET framework. So my guess is the other machines have a certain Service pack installed, and this one machine hasn't.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
boulder_bumAuthor Commented:
Good guess! Definately a useful bit of info.

Unfortunately (or fortunately), all the machines look up-to-date on the patches.
maybe this KB is any help
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

boulder_bum, sometimes the above exception is caused by calling to a COM object. InnerException property holds the real exception with its description. So write to Event Log inner exception and see what was the problem. It was written in notepad and was not tested.

try{ //your code
catch( Exception e)
    string errorMessage = null;
    if ( e.InnerException == null )
      errorMessage = e.Message;
    else if ( e.InnerException.InnerException == null )
              errorMessage = e.InnerException.Message;
           else errorMessage = e.InnerException.InnerException.Message;

    // Write errorMessage to Event Log

boulder_bumAuthor Commented:
I ended up e-mailing myself the entire solution and it turns out that my subclassed LicenseManager tried to reference a file that got created after a certain point in processing. The issue didn't show up before because I didn't license the class until a recent build.

Why a FileNotFoundException wasn't thrown is a little puzzling to me, but at least it works now.

Razzie and Jigit got the bigger points because I thought the answers were most likely to help, but I appreciate your effort, Tom, so props to you, too.
Sorry it wasn't THE answer you were looking for, but glad you got it all figured out anyway :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.