我已经安装了Visual Studio 2015 Community Edition。我已经安装了Xamarin试用版。我在Xamarin iOS Universal项目中使用以下示例代码AppDelegate.cs。
当我使用Debug.WriteLine
将消息写入Visual Studio输出窗口时,我似乎将消息重复了3次。
当我使用Console.WriteLine
我的信息没有被重复时,似乎偶尔会出现某种竞争条件导致我的一些消息突破两条不同的行。
示例代码:
using System;
using System.Diagnostics;
using Foundation;
using UIKit;
namespace LandingDay.Example1.Xamarin.iOSUniversal
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Debug.WriteLine("This is a test. ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz");
for (int i = 0; i < 20; i++)
{
Console.WriteLine("This is a test. ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz");
}
return true;
}
}
}
必需的行为:
能够像在Xamarin iOS Universal项目中的示例代码中那样写入Visual Studio Output窗口,而不会重复3次消息或间歇性地断开多行消息。