473,385 Members | 1,798 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,385 software developers and data experts.

Strange problem when not in debugger

Hi,

When I start my program in the debugger, there is no problem, but when not I
get an exception.

It appears in:

private void Upload(string filename, string FTnaam)
{
MessageBox.Show("in upload.");
FileInfo fileInf = new FileInfo(filename);
MessageBox.Show("file: " + filename + " upload: " + FTnaam);

string uri = "ftp://" + F1.FTPserver + FTnaam; // fileInf.Name;
FtpWebRequest reqFTP;
MessageBox.Show("Uri :" + uri);

// Create FtpWebRequest object from the Uri provided
- reqFTP = (FtpWebRequest) FtpWebRequest.Create(new Uri("ftp://"
+ F1.FTPserver + FTnaam));
here its going wrong

Apr 7 '08 #1
8 1264
On Tue, 08 Apr 2008 09:41:02 -0700, Rinaldo
<zw*************@hotmail.com.nospamwrote:
Positive that the string return the same value. Even when I hardcode the
URL + path without calling any variable I get the same error.
The bottom line: until you post a concise-but-complete code example that
reliably reproduces the problem, you're unlikely to get an actual answer.
Apr 8 '08 #2


"Peter Duniho" <Np*********@nnowslpianmk.comschreef in bericht
news:op***************@petes-computer.local...
On Tue, 08 Apr 2008 09:41:02 -0700, Rinaldo
<zw*************@hotmail.com.nospamwrote:
>Positive that the string return the same value. Even when I hardcode the
URL + path without calling any variable I get the same error.

The bottom line: until you post a concise-but-complete code example that
reliably reproduces the problem, you're unlikely to get an actual answer.
Must I post it here or somewhere else?
Apr 10 '08 #3
On Wed, 09 Apr 2008 17:56:38 -0700, Rinaldo
<zw*************@hotmail.com.nospamwrote:
Here it goes:
I have a hard time believing that that code example is the minimum amount
of code required to reproduce the problem.

Suffice to say, with an example that complex, the number of people likely
to spend time looking at it is much smaller than if it were more concise.
If you are absolutely sure that that is the smallest sample you can
provide, you'll have to accept that severe restriction of your audience,
possibly to the extent that you won't get an answer at all.

Pete
Apr 10 '08 #4
Ihope that it was all. If missing something, I hear it. The program's that I
make are free for charge. It is a hobby of my. In the past, 20 years ago, I
programmed C, but gorget all about it.

"Peter Duniho" <Np*********@nnowslpianmk.comschreef in bericht
news:op***************@petes-computer.local...
On Wed, 09 Apr 2008 17:56:38 -0700, Rinaldo
<zw*************@hotmail.com.nospamwrote:
>Here it goes:

I have a hard time believing that that code example is the minimum amount
of code required to reproduce the problem.

Suffice to say, with an example that complex, the number of people likely
to spend time looking at it is much smaller than if it were more concise.
If you are absolutely sure that that is the smallest sample you can
provide, you'll have to accept that severe restriction of your audience,
possibly to the extent that you won't get an answer at all.

Pete
Apr 10 '08 #5
On Thu, 10 Apr 2008 02:38:00 -0700, Rinaldo
<zw*************@hotmail.com.nospamwrote:
Ihope that it was all. If missing something, I hear it.
Are you serious? The single post to which I replied, in which I pointed
out that the sample was FAR too large to be useful, was not actually the
entire sample?

You _really_ need to pare your code example down for anyone to look at
it. I know I'm not going to sift through all of that just to try to find
the answer to the one question. I'd be surprised if anyone else would
either.

I realize that doing so may be challenging, but it's really the only way,
at least if you're asking the question here. This is a volunteer effort,
and for people who are paid to solve your problems, the work involved in
taking your entire program as the "sample" is far too great a barrier. If
you're not willing to put the effort in yourself to come up with a
reasonable, concise example, you should consider paid support from
Microsoft. It'll cost you money, but you'll have the luxury of being able
to send them your entire application and have them help you with it.

Pete
Apr 10 '08 #6
How small it must be? I thought you mean the whole code. The first message
is with the code wich goes wrong. Pfff I read the message with a dictionary
with me.

Here it goes wrong in the code:

private void Upload(string filename, string FTnaam)
{
// MessageBox.Show("in upload.");
FileInfo fileInf = new FileInfo(filename);
// MessageBox.Show("file: " + filename + " upload: "
+ FTnaam);

string uri = "ftp://" + F1.FTPserver + "/"; //
ftp://ftp.lampiesoft.nl goes also wrong as uri
FtpWebRequest reqFTP;
MessageBox.Show("Uri :" + uri);

// Create FtpWebRequest object from the Uri provided

reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
//"ftp://" + F1.FTPserver + "/" + FTnaam));

with the call to new Uri(uri)

I thought the whole code mabe someone can reproduce it.

I think some english/american sentences I do not understand correctly, I try
it but there are nu C# groups in dutch where I can ask.

Sorry for the unconvinience.

Rinaldo

Apr 11 '08 #7
On Fri, 11 Apr 2008 08:52:53 -0700, Rinaldo
<zw*************@hotmail.com.nospamwrote:
How small it must be?
It must be no larger than the absolute minimum required to reproduce the
problem. It must be no smaller than the minimum amount of code that can
be compiled without adding anything.

The original code you posted isn't complete (nor the latest, which is the
same). It uses variables that aren't declared and for which we have no
way of knowing their values. The "whole code" you posted isn't even close
to being concise. It is literally the whole code, which isn't what I
asked for. "Complete" simply means that I don't have to add anything. It
doesn't mean that I need every line of code you've written.

Here's a concise-but-complete code example that _doesn't_ reproduce the
problem:

using System;
using System.Collections.Generic;
using System.Text;

namespace TestCreateUri
{
class Program
{
static void Main(string[] args)
{
Uri uri = new Uri("ftp://ftp.lampiesoft.nl");

Console.WriteLine("Uri: " + uri.ToString());
Console.ReadLine();
}
}
}

You claimed that there's a problem creating the Uri. You create the Uri
using a string, so it should be possible to post code that simply passes
some string literal to the constructor and throws the exception.

In my example, I used the only full URL you offered as my test string. It
runs just fine, so obviously that string isn't the one throwing the
exception.

Hopefully, you can provide something similar to the above but with a
string that does throw an exception. Then someone here (maybe even me)
can explain why the string's not valid.

It's _possible_ that you may need to provide more elaborate code. In that
case, that would mean that there's something other than just the string
causing the problem. That the string itself is normally valid, but that
something else in your code is somehow causing it to be invalid.
Hopefully that's won't be the case; if it is, it is likely to take a lot
more effort on your part to come up with an example. However, if it is
the case, then the only way for you to get help is to provide that
example. No one here gets paid enough to sift through your complete
application code to try to find the magic combination that causes the
error.

So, as a first step: try to provide the very simplest example. What's the
string being passed to the constructor when the exception is thrown? Does
passing that string to the constructor cause the exception even in the
context of a program as simple as what I showed above? If so, write a
version of the code above using that string, so that we can see what the
actual string is.

If not, then you need to figure out how to make a program that contains
the very minimum amount of code that will still reproduce the problem.
The most direct way to do that is to create a copy of your existing
project and start removing things until the problem goes away. Start with
the things that seem the least necessary.

As I said, the exercise itself may lead you to the problem and you won't
need anyone else to point it out. But at the very least, when you're done
you'll have a nice, simple example that you can post here.

Pete
Jun 27 '08 #8
Thank you Pete for explanation. I now know the problem. Anyway anyhow VS
doesn't clean up the bin directory or whatsoever.
I had deleted the bin folder and try again. Someway somehow it worked again
(the program) This was pure luck I did it because I had enough of it.
I now understand that a small amount of code posted here must be enough for
example.

I hope that someone can make use of my (lucky) deletion for someone with the
same error, however I think it is not happend very much.
I shal remember the things you told me.

Again, thanks for the support, because it is hard to seek an error in
someone els its code.

Rinaldo
Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: cduden | last post by:
Not sure which group this question would go in so if this isn't the appropriate place I apologize. Here is the setup -- Rather large project consisting of a Winform client that communicates...
4
by: Zhang Weiwu | last post by:
This is really very stange. I have a form like this: <form id="form_A"> xxxx </form> This form is on one page in a page of a web application, it is the only form on that page. on the end of...
1
by: moondaddy | last post by:
I tried to add the exception management block to my asp.net 1.1 application today and was getting some errors with it the application, so I removed it. When I re-loaded the app I got an error about...
1
by: BG | last post by:
Hey Everyone, Win2K Pro w/all Updates, VB.Net Standard 2003, .NET 1.1 w/all updates I have a web app that I've been working, coding,testing,coding, etc. Works fine - debugger debugs stuff as...
6
by: Gary | last post by:
I have an application that has been working just fine for a couple of years. It queries a SQL database and returns some formatted data back to the client. I have a new client, who has a larger...
7
by: Tyler Foreman | last post by:
Hello, I have a strange problem that occurs every so often in my application. It usually takes place when I hide one form and activate another. What happens is I get the following exception:...
10
by: tborn | last post by:
Hi there, Not sure if any one has experienced this before and can tell me what's wrong with this statement: if verified = false then dataObjects.HasError = true This is all on one line...
0
by: birdinhand | last post by:
Hello, all. After trying to wade through a great deal of undocumented and uncommented code in order to speed up a frame capture rate, I've decided that, for my sanity and that of my boss and any...
11
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating...
11
by: Mike C# | last post by:
Hi all, I keep getting a strange error and can't pin it down. The message is: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.