Bug 11772 - Race condition causing code to be missed when reading a file
Summary: Race condition causing code to be missed when reading a file
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.7.x
Hardware: Macintosh Mac OS
: High normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-04-13 19:25 UTC by Paul Johnson
Modified: 2014-06-21 17:11 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Paul Johnson 2013-04-13 19:25:40 UTC
Consider the following code

while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        if (reader.Depth > 1 && !depth)
                            depth = true;
                        switch (reader.Name)
                        {
                            case "MoneyID":
                                reader.Read();
                                aff.MoneyID = Convert.ToInt32(reader.Value);
                                break;
                            case "MoneyInfo":
                                reader.Read();
                                clean = sanitise(reader.Value);
                                aff.MoneyInfo = string.IsNullOrEmpty(reader.Value) ? empty : clean;
                                break;
                            case "ReplicationID":
                                reader.Read();
                                aff.ReplicationGuid = reader.Value;
                                break;
                        }
                    }

The sanitise routine looks like this

private string sanitise(string toClean)
        {
            string original = toClean, toReturn = string.Empty;
            toReturn = original.Replace("'", "#").Replace("……", " - ").Replace("…", ".");
            return toReturn;
        }

With the 4.6 branch, a break point at the clean = sanitise(reader.Value) and one at the return line in sanitise would stop at the correct points. In the 4.7 branch the break points are never checked or the sanitise routine called. I've tried this with separate .Replace calls and it is still not hitting the break point
Comment 1 Jonathan Pryor 2014-01-10 16:37:54 UTC
Is this still a problem in Xamarin.Android 4.10?
Comment 2 Paul Johnson 2014-01-10 17:22:38 UTC
It seems to be hitting the break points on xml functions now, I've not given it any sort of rigourous testing recently, but I seem to remember there not being an issue
Comment 3 Paul Johnson 2014-06-21 17:11:37 UTC
This is working as it should in the current release branch. Closing