Showing posts with label Web service. Show all posts
Showing posts with label Web service. Show all posts

Sunday, March 01, 2009

Building an application (4) ...

.. weird debugging problem

One more thing that I have encountered on my wonderful journey in building my first Silverlight application is a debugging issue.

It just not works straight out of the box in Visual Studio 2008. I know, I know, it must be me with all sorts of software loaded or what. Or the missing hotfix 98662654a. But just keeps biting me.

What's up, doc?

I start VS 2008 and make some very very clever changes or just want to try out something. So I set a breakpoint at the right line in the code and hit F5. Easy.

Lots of things happen. The application is built. Well, three applications are built: the Silverlight app, the web app and the web service. So far, so good.

I start my testing and the breakpoints are never hit. At least the IDE does not stop.

And yes, I am running in Debug mode.

What's the cure, doc?

I have found that stopping the debug session (by hitting Shift-F5 in the IDE) and the right-clicking the Web Service project and selecting Debug - Start New Instance does the trick.

Breakpoints are once more hit and they do cause the code to break at those points.

So, what's up, doc?

I honestly can see here that I have no idea. The trick above works for me and to me that is enough.

So, if you come across breakpoints never really breaking than the above trick might work for you.

Reblog this post [with Zemanta]

Thursday, February 12, 2009

Building an application (2) ...

.. coming full circle

In the first part of this journey I have sketched the outlines of my application. The combination of web pages, web service and Silverlight as I plan to build it.

Jumping hurdles and dodging bullets

While building and debugging I have run into numerous obstacles. Not only did Chrome give me an unexpected headache by not refreshing the Silverlight XAP file in the cache, also Visual Studio behaved weirdly during debugging sessions. At first I couldn't make any of the breakpoints work. Only after using the context menu on the web service and picking 'Debug - Start a new instance' did execution break at the breakpoints. And then after a couple of hours it failed all breakpoints completely. Restart of Visual Studio and browser did not work. A full reboot did the job.

BTW I have logged a bug with Chromium for the caching problem.

However

My Proof of Concept piece of spaghetti has now come full circle:

  1. I drag and drop some players, balls on the pitch.
  2. Enter some extra info: name of the excercise and some extra text.
  3. Save the data to the data base using the web service.
  4. The asynchronous callback adds some html to the DOM, which is an image that is generated by a special HttpHandler.
  5. The image shows up in the browser.
  6. I have a smile on my face.
Lots of work to do

en: Picture of a girl rubbing her temples.Image via Wikipedia

There is still lots of work to do:

  • a real user interface has to be designed
  • better, I need to sit down and get the complete UX designed
  • have to add the boring user authentication stuff
  • try out the concept on a real web server
  • implement some of the missing graphical pieces, like lines with arrows
  • think of good way of editing the lines
  • undo / redo ?
  • make the database complete
  • add functionality for picking existing excercises, sharing these, copying, editing etc.

Yep, there is lots to do and so little time.

A little bit more tchnical info in Part 3.

Reblog this post [with Zemanta]

Sunday, February 01, 2009

How Microsoft made me leave Google Chrome

.. well, not really

As I wrote in my previous post I am busy building a Silverlight application. This week I did some more work and ran into some very weird behavior.

I was debugging the communication between the Silverlight app and the web service and I ran into very strange errors. I noticed that in my final call in the webservice two string values were assigned to the wrong variables. They were swapped. The variable username held a piece of xml and the variable drawingXml held the username. Looking through my code I could not find the line of code where I made the mistake.

It was getting late already and this is still a POC, so I decided to just swap the place of the parameters in the method definition and investigate further at some other moment.

I stopped the debugger, made the change, inserted a breakpoint and started debugging again. That's when I completely lost any understanding of what was going on.

It was late already as I said and I blamed that and I was too tired to think straight and probably was debugging at the wrong place in the application. I decided it had to be me and had to just let it be. I walked a block with the dog and went to bed

The next day

The problem stuck and I had to investigate further so I started to change my Silverlight application so it would show some debug info in the browser to make things easier to debug.

That's where things started to go even crazier. The Silverlight application didn't show anything. The TextBlock I had added to the XAML wasn't showing up! I tried again and again. But nothing!

Google ChromeImage via Wikipedia

Then I realized that Google Chrome (my default browser) had a problem with caching. The Silverlight application in the browser was an old version of the application. Apparently, Chrome was not refreshing the XAP file!

Googling about I saw some posts about the same problems developers had with Flash. Then I sighed and I knew it was not me.

Google Chrome

So, that was it for me. I had to revert "back" to Firefox for debugging Silverlight applications. A weird feeling having to step away from Google Chrome.

I still remember that I watched the launch live on my laptop. I watched the first part in Firefox and started downloading during the presentation. Installed Chrome and watched the last part in Chrome. I also set it to be my default browser and only occasionally I use Firefox and other browsers. Well, I have to I build websites!

Microsoft made me do it

So, in a way Microsoft made me switch browsers, made me move away from Chrome.

But it's not that dramatic. I only use Firefox now for debugging Silverlight and for day to day browsing I still use Chrome.

Had I been a Flash developer, it would have been Adobe that made me switch from Chrome back to Firefox. But still only for debugging.

Reblog this post [with Zemanta]