You can checkout, but you can not commit
Well, here is how my last few days were spent. Trying to get SvnBridge to work on Mono 1.9.1. (Note that we are talking about working locally, when the hosted version will go live, it will obviously be accessible from everything and anything that can talk to an SVN server).
After getting it to compile and run (not a trivial process, I must say, I used a surprisingly high number of MS CLR stuff, but we will leave that to another post), I had managed to get some basic functionality working, and I was able to successfully checkout the source of SvnBridge itself.
Unfortunately, when I tried to commit those changes, I run into several... problems.
Without beating too much around the bush, the issue was that authentication errors against the TFS web service API. More specifically, in the error handling of those authentications errors.
In several parts of SvnBridge, we have code similar to this:
try { return tfsWebService.DoSomething(); } catch(WebException we) { HttpWebResponse r = we.Response as r; if( r != null && r.StatusCode == HttpStatusCode.Unauthorized ) throw new NetworkAccessDeniedException(we); }
The problematic part is bolded and in red. As I already mentioned, there is a subtle but incredibly annoying difference between Mono and .Net. This means that code such as this will never work. The issue is that the Mono implementation of HttpWebResponse check to verify that no access is done to a disposed object. Precisely like a well behaved object should. The .Net implementation does not.
By the time that the SOAP stack implementation (on both sides) gives you the web exception, the web response has been disposed. But on the Mono side of things, you can't even find out why.
As a result, I made up this logo.
I have reported the issue to the Mono guys, and hopefully they will get this fixed.
Comments
Strange behaviour, but what I do not understand is that you get a HttpWebResponse returned which you did not dispose. So either it should return null as the returned object wouldn't have any value or return an instance that is not disposed...
That is a great idea, send them a patch for it!
Err so surely you can commit, as long as you are authenticated? Or did I miss something?
Ramon,
I get the value in the WebException, and it is required that it would be there so error handling could work
Thomas,
I did:
http://ayende.com/Blog/archive/2008/07/01/Guess-how-I-found-that-out.aspx
The way auth works in these scenarios is that you get a 401 and then you make a second call, with the proper credentials.
Since I can't tell if I got 401, I can't send this to my users, which will then supply me with the credentials
We are sorry for this bug.
The bug seemed to have been fixed in April 21 of this year. Sadly we have delayed our 2.0 release to get a number of important improvements.
Mono from SVN or the daily builds will work for the time being.
Miguel.
Wow, that is fast response time.
I ran into a similar problem testing a REST API. Why is an exception even thrown? It seems like they're overstepping bounds by telling me what HTTP status codes are "exceptional." Did the request go through? If yes, then don't throw any exceptions regardless of the HTTP status code, which, IMHO, sits above .NET exceptions; I will interpret the response with what's logical to the application.
Wow... this is amazing :) Props for the Mono team.
Comment preview