Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. Just wasted two hours on one of those difficult to spot typos [modified]

Just wasted two hours on one of those difficult to spot typos [modified]

Scheduled Pinned Locked Moved Clever Code
helplearning
4 Posts 3 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin McFarlane
    wrote on last edited by
    #1

    Had this

    using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
    {
    host.AddServiceEndpoint(typeof(CalculatorService.Calculator), new NetNamedPipeBinding(), "Calculator");
    host.Open();
    Console.WriteLine("Press to terminate the service host");
    Console.ReadLine();
    }

    Kept on getting missing ServiceContract attribute error. I kept on comparing it with a structurally similar app. that worked fine. In the end I had to copy and paste this other app. into mine and then make mine look as similar as possible. Then I finally spotted the typo! :-O :wtf:

    using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
    {
    host.AddServiceEndpoint(typeof(CalculatorService.ICalculator), new NetNamedPipeBinding(), "Calculator");
    host.Open();
    Console.WriteLine("Press to terminate the service host");
    Console.ReadLine();
    }

    The second typeof should have read CalculatorService.ICalculator not CalculatorService.Calculator. Of course, if I'd have been at work, a co-worker would most likely have spotted this.

    Kevin

    modified on Monday, October 20, 2008 1:09 PM

    K T 2 Replies Last reply
    0
    • K Kevin McFarlane

      Had this

      using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
      {
      host.AddServiceEndpoint(typeof(CalculatorService.Calculator), new NetNamedPipeBinding(), "Calculator");
      host.Open();
      Console.WriteLine("Press to terminate the service host");
      Console.ReadLine();
      }

      Kept on getting missing ServiceContract attribute error. I kept on comparing it with a structurally similar app. that worked fine. In the end I had to copy and paste this other app. into mine and then make mine look as similar as possible. Then I finally spotted the typo! :-O :wtf:

      using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
      {
      host.AddServiceEndpoint(typeof(CalculatorService.ICalculator), new NetNamedPipeBinding(), "Calculator");
      host.Open();
      Console.WriteLine("Press to terminate the service host");
      Console.ReadLine();
      }

      The second typeof should have read CalculatorService.ICalculator not CalculatorService.Calculator. Of course, if I'd have been at work, a co-worker would most likely have spotted this.

      Kevin

      modified on Monday, October 20, 2008 1:09 PM

      K Offline
      K Offline
      Kyudos
      wrote on last edited by
      #2

      Well...of course....doesn't every programmer know that the easiest way to find embarrassingly simple errors is to show your code to someone else? ;) If you're lucky, the very act of asking for a fresh pair of eyes will make YOU see the problem, in which case you can quickly say 'Oh nevermind, its ok...' and pretend you didn't just spend hours going on all sorts of wild-goose debugging escapades in order to find a typo.... :rolleyes:

      K 1 Reply Last reply
      0
      • K Kyudos

        Well...of course....doesn't every programmer know that the easiest way to find embarrassingly simple errors is to show your code to someone else? ;) If you're lucky, the very act of asking for a fresh pair of eyes will make YOU see the problem, in which case you can quickly say 'Oh nevermind, its ok...' and pretend you didn't just spend hours going on all sorts of wild-goose debugging escapades in order to find a typo.... :rolleyes:

        K Offline
        K Offline
        Kevin McFarlane
        wrote on last edited by
        #3

        Kyudos wrote:

        the very act of asking for a fresh pair of eyes will make YOU see the problem

        Yep. Happens all the time. :)

        Kevin

        1 Reply Last reply
        0
        • K Kevin McFarlane

          Had this

          using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
          {
          host.AddServiceEndpoint(typeof(CalculatorService.Calculator), new NetNamedPipeBinding(), "Calculator");
          host.Open();
          Console.WriteLine("Press to terminate the service host");
          Console.ReadLine();
          }

          Kept on getting missing ServiceContract attribute error. I kept on comparing it with a structurally similar app. that worked fine. In the end I had to copy and paste this other app. into mine and then make mine look as similar as possible. Then I finally spotted the typo! :-O :wtf:

          using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
          {
          host.AddServiceEndpoint(typeof(CalculatorService.ICalculator), new NetNamedPipeBinding(), "Calculator");
          host.Open();
          Console.WriteLine("Press to terminate the service host");
          Console.ReadLine();
          }

          The second typeof should have read CalculatorService.ICalculator not CalculatorService.Calculator. Of course, if I'd have been at work, a co-worker would most likely have spotted this.

          Kevin

          modified on Monday, October 20, 2008 1:09 PM

          T Offline
          T Offline
          ToddHileHoffer
          wrote on last edited by
          #4

          Kevin McFarlane wrote:

          Of course, if I'd have been at work, a co-worker would most likely have spotted this.

          Yeah, sometimes it is rough being on your own. I am the ONLY .net programmer at my company. On bigger projects I work with consultants but 95% of the time, I am on my own.

          I didn't get any requirements for the signature

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups