Strange problem when not in debugger

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rinaldo

    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(filena me);
    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.C reate(new Uri("ftp://"
    + F1.FTPserver + FTnaam));
    here its going wrong

  • Peter Duniho

    #2
    Re: Strange problem when not in debugger

    On Tue, 08 Apr 2008 09:41:02 -0700, Rinaldo
    <zwartehoofdpie t@hotmail.com.n ospamwrote:
    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.

    Comment

    • Rinaldo

      #3
      Re: Strange problem when not in debugger



      "Peter Duniho" <NpOeStPeAdM@nn owslpianmk.coms chreef in bericht
      news:op.t9axudl u8jd0ej@petes-computer.local. ..
      On Tue, 08 Apr 2008 09:41:02 -0700, Rinaldo
      <zwartehoofdpie t@hotmail.com.n ospamwrote:
      >
      >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?


      Comment

      • Peter Duniho

        #4
        Re: Strange problem when not in debugger

        On Wed, 09 Apr 2008 17:56:38 -0700, Rinaldo
        <zwartehoofdpie t@hotmail.com.n ospamwrote:
        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

        Comment

        • Rinaldo

          #5
          Re: Strange problem when not in debugger

          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" <NpOeStPeAdM@nn owslpianmk.coms chreef in bericht
          news:op.t9dgkdl n8jd0ej@petes-computer.local. ..
          On Wed, 09 Apr 2008 17:56:38 -0700, Rinaldo
          <zwartehoofdpie t@hotmail.com.n ospamwrote:
          >
          >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

          Comment

          • Peter Duniho

            #6
            Re: Strange problem when not in debugger

            On Thu, 10 Apr 2008 02:38:00 -0700, Rinaldo
            <zwartehoofdpie t@hotmail.com.n ospamwrote:
            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

            Comment

            • Rinaldo

              #7
              Re: Strange problem when not in debugger

              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(filena me);
              // 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.C reate(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

              Comment

              • Peter Duniho

                #8
                Re: Strange problem when not in debugger

                On Fri, 11 Apr 2008 08:52:53 -0700, Rinaldo
                <zwartehoofdpie t@hotmail.com.n ospamwrote:
                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.Collecti ons.Generic;
                using System.Text;

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

                Console.WriteLi ne("Uri: " + uri.ToString()) ;
                Console.ReadLin e();
                }
                }
                }

                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

                Comment

                • Rinaldo

                  #9
                  Re: Strange problem when not in debugger

                  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


                  Comment

                  Working...