Error Handling Using Reflection And Obfuscation?

May 4, 2011

I use a standard error handling routine in my methods that looks like the following:

Try
Cursor.Current = Cursors.WaitCursor
Cursor.Current = Cursors.Default

[code].....

View 1 Replies


ADVERTISEMENT

Nightmare Error: System.Reflection.TargetInvocationException Error In VB 2008?

Feb 20, 2009

Nightmare error: System.Reflection.TargetInvocationException error in VB 2008

View 6 Replies

Casting After Obfuscation With Dotfuscator?

Mar 1, 2010

I'm trying to obfuscate some VB.NET 2003 app.The resulting assemblyes are obfuscated and "run" with some errors.I cleaned all potential reflection problems, but I'm not being able to read the selected value of a combobox.

I load the Combobox using their Datasource properties, using a collection of "VTPair" (a class created by me with 2 properties: one of string type and other of object type to store the value)

This combobox handle pairs like "Male | M" or "Female | F".When trying to see what is selected, I use if mycombo1.SelectedValue = "M" then.This code, after obfuscation, throws me an exception that cannot cast type "XX" to string "M".

So, I changed the code to something more correct, explicitly casting the selected value to String:

if ctype(mycombo1.SelectedValue,string) = "M" then But the error is the same.Debugin my original code, the SelectedValue property is of type "Object" but it is a string.I tried using the ComboBox.SelectedItem property that is also an object but this time what is inside is of type "VTPair" (my own class) and then trying to access its "Value" property (which is of type Object) and trying to cast to string fails again.

Does anyone have an idea to "translate" this piece of code to work OK after Dotfucate it?

View 2 Replies

String Obfuscation And Function Names

Aug 19, 2010

Can I change the following code and safely obfuscate it ? or that I must exclude it from obfuscating (e.g. stackoverflow 2555355 obfuscating-asp-net-dll / 2555497#2555497 )

Dim fontNames As New ArrayList
. . .

Me.myCtrlCmbFontName.DataSource = fontNames

[CODE]...

View 2 Replies

VS 2008 Protect Product Obfuscation?

May 19, 2009

I've developed a product, I now want to protect it from reverse engineering and decompilation, can anyone share some info about this..?I'm looking for the BEST product out there, for doing this, I want to make it a pain to decompile or reverse engineer my product =)Does anyone know of any? or any other products that do other things that can help protect it, for example, I once found a program which converts ALL your .NET exe, into a C++ exe file, so it's not .NET code anymore, fully machine code or something like that (can't find it anymore though).

I thought posting here would be a good idea, since, a lot of you are very experienced with developing products, and perhaps some of you have used obfuscator's to protect them.

View 14 Replies

Asp.net - Error Handling Using Events, Checking If An Error Happened And React Accordingly?

Sep 8, 2009

I have an object, say Order where if an error occurs, it raises the ErrorOccurred event. If I'm running some code in say, the codebehind for a .aspx page with an public Order registered as WithEvents and I want to check to see if an error has occurred before I run more code, how do I do this? I can't simply check theOrder.ErrorOccurred. Do I have to create a local boolean flag that switches over in the event handler (OnErrorOccurred)?

Example:

Public WithEvents theOrder As New Order
Public Sub DoStuff()
theOrder.DoSomething()
If theOrder.ErrorOccurred Then

[code]....

View 3 Replies

Using Reflection To Capture Error Details?

Dec 14, 2010

I have a quick question that hopefully someone has worked through before. In the system that I am currently working on, we have rolled our own custom provider for handling web exceptions. One of the things that I like about this provider is that it allows us to add in parameter values of the method that throws the exception. The code looks something like this.

Public Sub Dosomething(ByVal Parameter1 As String, ByVal Parameter2 As String)
Try
'Do some process that causes and error.
Catch ex As Exception

[code]....

View 2 Replies

Deployment :: Reflection Error Loading Assembly?

Jun 18, 2008

i am writing a simple games client using an XNA 2.0 engine to play games. The games are written in dll files and the client uses the assembly.loadfrom method to read and execute the games accordingly...Now this all works fine on my computer and my laptop. However when i give it to my friend he gets this error and the dll doesnt load - "Unable to load one or more of the requested types. Retrieve the loader exceptions property for more information"

View 1 Replies

Error Handling Should Be Used In .NET

Jun 15, 2010

What error handling should be used in VB.NET? Should one use the "On Error Goto ErrorHandler Exit Sub ErrHandler ... End Sub" pattern or should you use the "try {... } catch {...} finally {... }" pattern?

View 4 Replies

.net - Handling Error Strings?

Aug 14, 2009

In my vb.net application if I have a known set of Error Strings i.e.

Failed because I don't know about it
Failed because I know about it but I can't find it
Failed for another reason

[code].....

View 6 Replies

Error Handling With Messagebox

May 21, 2011

I am just doing a bit of error handling. I am just check to make sure that a user has selected an option within a combo box (named cbtitle1) and if option has not been selected throw an error message to tell the user.this if statement is within a save button which once a user click save this error checking runs first then if combo box has an option selected the save goes ahead else it throws an error.I can stop the save function OK but I wanted to put a error icon in with the message box but I get an error when I add it.[code]

View 3 Replies

Error Handling. When And When Not It's Needed?

Dec 21, 2009

Obviously error handling is a major factor in making a good application. If a error happens letting a user know what has gone wrong.But some times error handling may(i think) not be needed. Example.

Private Sub RemoveCheckedl()
Try
For Each Item As ListViewItem In lst.CheckedItems[code]....

also when error handling it's could to think about what type of errors could be made.

Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

even though this catches the error and displays a msg, it may not be a great message for the user so he/she can understand.

View 21 Replies

Handling Error Within An Executable

Jan 29, 2010

I am working on an executable to load set of data into databases.I will be running it as a windows service. I will be doing several different checks to see if the fields exists in the incoming files. When i do the checks using if statements.I would like to stop processing when a major error occurs or when any thing is interrupted Like say windows crashed. I would like to create an error file with the error message in it for that particular file. I would be monitoring error folder everyday to check if there are any errors.

View 1 Replies

Use Custom Error Handling?

Mar 8, 2010

When debugging a program, instead of doing this on EVERY piece of code:

Try
MyFunction()
Catch ex as Exception
MsgBox(ex.Message)
End Try

Is there a way to apply that to everything error I encounter without writing it on every function/sub/etc?

View 3 Replies

.net - Error Handling Message Types?

Mar 13, 2012

I am using try..catch for error handling. I am getting the message displayed as

messagebox.show (ex.tostring)

But it gives very long message.Is it possible just to get only the actual error or I could give my own modified message, based on what ex contains?

View 5 Replies

C# - Error Handling In DTS Package Execution Using .NET

Oct 20, 2010

I am executing a SQL Server 2000 DTS package using C# by following the code from this article [URL]. once the package is executed I am looping through each step to find out if any step has failed and get info about error if it has failed. I also use this information to find out if the package has succeeded or not (package failed if anyone step has failed).

[Code]....

View 1 Replies

C# - How To Design Overall Error Handling System

Jul 22, 2010

I am looking at implementing a Web Service API for our product. I have figured out how you go about the general architecture/fault handling within WCF. My question is a more general one of how to design the overall error handling system. For example I have a method called SaveCompany (companyobject). Each company name needs to be unique. Say you tried to save a second company called "ABC Inc.". Would you expect to get back a fault named "DuplicateCompanyFault", or would you expect to get back an error code, or something else? I guess the root of my question is would you prefer to receive faults to handle, error code, or some combination? These services are going to be consumed by multiple different entities outside our company on multiple non-.NET platforms.

View 2 Replies

Error Handling In Search Button

Aug 26, 2011

I am creating function for search data using textbox and button. i want to put an error handling in my code which if the data was not found then it will appear in message box "Data is not found. For your info i am using visual studio and sql 2005. Here is my code and i also attach my picture

Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click
Me.StaffBindingSource.Filter = "NAME = '" & Me.txtsearch.Text & "'"

[Code].....

View 1 Replies

Error Handling Procedure Calls?

Oct 14, 2009

I have an issue with handling errors in procedure calls in VB6.

View 6 Replies

Error Handling When Using VB 2010 Express?

Jun 3, 2012

I used the following code(with bug):

Code:
For n = 0 To 100
If saveLine(n).Substring(0, 8) = "heading:" Then
cboSelect.Items.Add(saveLine(n).Substring(8))
End If
Next n

The For loop only ran 5 times. It turned out that saveline(5) was shorter then 8 characters, so I changed the code which solved the problem:

Code:
For n = 0 To 100
If saveLine(n).Length > 8 Then

[code]....

VB 2010 neatly exits the for loop when the bug occurs. In this case it was easy for me to pick up the bug, because the combo box was not properly populated. What if it was not obvious that the for loop did not complete? It is quite scary to think that bugs like this are not displayed at run time.

View 4 Replies

Generic Error Handling Class?

Jan 10, 2012

We are developing an application for our shop floor. This program will be tracking material through the shop and we need to capture any errors the program generates, but we don't need to stop the program for all errors. I have some code to do a screen capture and put it in a database with exception.tostring data for debugging.

What we would like to do, is create an exception from the base class, but provide additional properties to allow us to set a severity and a user friendly error message. I would like to encapsulate this in a class that we would call in the catch of a try/catch, set the properties on the class, have the class record the data to the database, then raise the exception to the main program to display only the user friendly message and severity. The main program would then determine the severity and based on the severity stop the program or just display a discreet msg and continue to process.

Does anyone have an example of a custom exception class derived from exception that does something similar, or if I heading in the wrong direction, does anyone have a better solution?

View 5 Replies

Handling Connection Timeout Error?

Dec 13, 2009

Sometimes when my server is down or busy, I get an error saying "connection timeout" while connecting to MySQL. But with the error the program also crashes. My question is how can I prevent crashing, it would be better to show a msgbox when this happens. (visual basic 2010)here is a screenshot of the error

I use this,
Dim connStr As String = "Database=mydatabase;" & _
"Data Source=datasrc;" & _

[code].....

View 2 Replies

Looking For Examples Of Error Handling Code

Sep 14, 2009

I have a routine that is called when an unhandled exception occures.It is called by the MyApplication_UnhandledException method in applicationEvents (which handles Me.UnhandledException)

I am looking for some code that manages disects the data provided to generate information that is of benefit to the debugging team.

View 16 Replies

VB Express Beginner Error Handling

Aug 20, 2010

I just need a good nights sleep, but Im simply reading through a file (2010 data) and for selected teams, accessing the corresponding data for the previous year (2009 data), which is held on a separate file. (I painstakingly input all the 2009 data manually)

ds1.Clear()
cmd1.CommandText = "SELECT * FROM Teams WHERE Team = ?"
cmd1.Parameters.Add(NewSqlCeParameter("Team", (ds.Tables(0).Rows(x) ("Team"))))
cmd1.Prepare()
cmd1.ExecuteNonQuery()

[Code]...

View 8 Replies

VS 2005 Error Handling Scope?

Mar 10, 2011

plain how error handling scope works. What I mean by that is if I have a sub called ImportData and in there I have a for loop to go through a list of files and in the for loop I call another sub routine called CheckData. All have catch error in. If a sub has a catch error in where does it go from its call.

Private Sub ImportData
Dim iLoop as Int16
Try

[code].....

View 10 Replies

VS 2010 AppActivate Error Handling?

Dec 17, 2011

I am trying to add some error handling for AppActivate if any error occurs.I initially tried using a try statement and cancelling the sub that calls the function where my AppActivate code is, but that didn't work.I have tried looping it, changing values and everything I know. I have Googled and nothing :S

Here is my I have removed all the error handling I tried to implement, however, this commented msgbox I would like to be included (that is, possible to execute) in any methods you present.

[Code]...

View 1 Replies

VS 2010 Unable To Do Error Handling

Feb 21, 2011

I was just wondering if it is considered overkill to add:

[code]...

To every sub in your project. And what would be the side effects of this if any.

View 6 Replies

Which Error Handling Model Is More Robust?

Sep 13, 2009

I'm kind of torn between these two error-handling models:Create a boolean Error and a string ErrorMessage property for your object. Catch all exceptions internally in the object's methods and pass the messages along using conditional logic from the caller, ie:

[Code]...

To me, it seems like the same amount of code either way, except that you have property code for the Error and ErrorMessage properties. However, you also can tell when an error occurs without having to check for exceptions. Which pattern should I go with?

View 6 Replies

Error Handling & Copying Folder Structure?

May 2, 2011

Below is a tiny program I modified from an example Microsoft code tutorial. This program simply copies .flac and .mp3 files from one specified folder to another, and if the file is already there it simply does not copy the file. I would like to make 2 changes to the program:

How would I go about making the error handling work (i.e. not crashing the program when an invalid input is made)?Also, a big change I would like to make would be for it to copy the folder structure and all files in the original folder (At the moment, it only copies files that are directly in the original folder, not files that are in folders inside the original folder).

[Code]...

View 2 Replies

Error Handling To Code (Get HTML-from Website)

Feb 20, 2011

Code:

Public Function ScreenScrapeHtml(ByVal url As String) As String
Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(url)

[code]...

If it cant reach a URL it will give me this error:

Code:
Webexception was unhandeled:
Dim sr As New StreamReader(objRequest.GetResponse().GetResponseStream())

How I can add some error-handling to this code? Like if it cant reach a URL.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved