Bug 14950 - * Assertion at debugger-agent.c:4154, condition `count > 0' not met
Summary: * Assertion at debugger-agent.c:4154, condition `count > 0' not met
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2013-09-24 05:23 UTC by Marek Safar
Modified: 2013-11-01 09:16 UTC (History)
3 users (show)

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 GitHub or Developer Community 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:

Description Marek Safar 2013-09-24 05:23:21 UTC
using System;
using System.Linq;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Threading;

public class App {
	const string svcWeatherURL = "http://worldweatheronline.com/feed/" +
		"premium-weather-v2.ashx" +
			"?key=74f77f53f2185451102805" +
			"&feedkey=16b77ef9ec185654102805" +
			"&format=xml" +
			"&num_of_days=2" +
			"&extra=localObsTime" +

	public static void Main (string[] args)
		int numThreads;
		if (args.Length == 0 || !int.TryParse (args [0], out numThreads))
			numThreads = 100;
		ThreadPool.SetMinThreads(40, 8);
		Run (numThreads);

	static void Run (int numThreads)
		var times = new ConcurrentBag<KeyValuePair<object, TimeSpan>> ();
		var sem   = new CountdownEvent (numThreads);

		for (int i = 0; i < numThreads; i++)
			ThreadPool.QueueUserWorkItem((num) => {
				Stopwatch sw = Stopwatch.StartNew();
				Console.WriteLine ("# t: {0}; e={1}", num, sw.Elapsed);
				times.Add(new KeyValuePair<object, TimeSpan>(num, sw.Elapsed));
				sem.Signal ();
			}, i);

		sem.Wait ();
		Console.WriteLine ("Execution times (sorted)");
		foreach (var e in times.OrderBy (v => v.Value)) {
			Console.WriteLine ("  {0,4}: {1}", e.Key, e.Value);
		Console.WriteLine ("finished");

	static bool DownloadWeatherDetailsFromService(string ZIPCode)
		DataSet dsWeatherURL = new System.Data.DataSet();

		using (WebClient objWebC = new WebClient())
				Stream dataFromService = objWebC.OpenRead(svcWeatherURL + ZIPCode); // Set a breakpoint here and do step into couple times
				return true;
			catch (Exception)
				return false;
Comment 1 Zoltan Varga 2013-09-25 10:47:04 UTC
I can somewhat reproduce this with master, single stepping from that line doesn't seem to work, the app seems to run for a while then it crashes.
Comment 2 T.J. Purtell 2013-10-31 20:01:24 UTC
This happens to me pretty reliably if I rapidly single step while the initial boot up phase of my app is going on.  There are a lot of threads/tasks doing different bits of work (network, database etc).  I also get random crashes in the debugger, which is why I tried single stepping rapidly (to try to find some reproducible case).  Observerd on 4.10.0+
Comment 3 Zoltan Varga 2013-11-01 09:16:48 UTC
Fixed in mono master e4a37a7663f7668d31cd26726cdb431f26013c17.