title: C# bruteforce application doesn't print anything when debugging and terminates when password is more than 1 letters long
body: <p>I have made this "bruteforce" program, but when I run it using algorithm 2 and the password is more than 1 letter, it stops and says: <code>Process is terminating due to StackOverflowException.</code>
  Also, when I try to debug this, it does not start and ask for the algorithm number. What do I do wrong? (I know the code is bad but you can still give me feedback and improvement ideas.)</p>
  
  <p>Using .NET Core on Linux and VSCode.</p>
  
  <pre><code>class Program
  {
      static string chars = "- -a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z-A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z-0-1-2-3-4-5-6-7-8-9";
      static string[] c = chars.Split("-");
      static string password = "";
      static string attempt = "";
      static Stopwatch sw = new Stopwatch();
      static int i_max_length = 1;
  
      static char first = Char.Parse(Char.ConvertFromUtf32(32));
      static char last = Char.Parse(Char.ConvertFromUtf32(126));
  
      static void Main(string[] args)
      {
          Console.ForegroundColor = ConsoleColor.Magenta;
          Console.Write("Algorithm: (1/2) ");
          string algorithm = Console.ReadLine();
          Console.Clear();
  
          Console.ForegroundColor = ConsoleColor.Cyan;
          Console.Write("Enter password: ");
          password = Console.ReadLine();
          Console.Clear();
  
          Program.sw.Start();
  
          if (algorithm == "1")
          {
              Start("");
          }
          else if (algorithm == "2")
          {
              CharForce("");
          }
      }
      static void Start(string previous)
      {
          if (previous.Length &gt;= i_max_length)
              return;
  
          foreach (string ch in Program.c)
          {
              attempt = previous + ch;
              //Console.WriteLine("{0}", attempt);
              if (attempt == password)
              {
                  Program.sw.Stop();
                  TimeSpan time = sw.Elapsed;
                  Console.WriteLine("Password: {0}", attempt);
                  Console.WriteLine("Time elapsed: {0}", time.ToString());
                  Environment.Exit(0);
              }
          }
  
          foreach (string ch in Program.c)
          {
              Start(previous + ch);
          }
      }
      static void CharForce(string p)
      {
          if (attempt != password)
          {
              if (p.Length &gt;= i_max_length)
                  return;
  
              for (char f = first; f &lt;= last; f++)
              {
                  attempt = p + f;
                  CharForce(p + f);
              }
          }
          else
          {
              Program.sw.Stop();
              TimeSpan time = sw.Elapsed;
              Console.WriteLine("Password: {0}", attempt);
              Console.WriteLine("Time elapsed: {0}", time.ToString());
              Environment.Exit(0);
          }
      }
  }
  </code></pre>