我的VS2013 Ultimate副本将此代码编译60秒以上:
class Program
{
static void Main(string[] args)
{
double dichotomy = Dichotomy(
d =>
{
try
{
int size = (int) d;
byte[] b = new byte[size];
return -b.Length;
}
catch (Exception)
{
return 0;
}
},
0,
int.MaxValue,
1);
Console.WriteLine(dichotomy);
Console.ReadKey();
}
private static double Dichotomy(
Func<double, double> func,
double a,
double b,
double epsilon)
{
double delta = epsilon / 10;
while (b - a >= epsilon)
{
double middle = (a + b) / 2; …Run Code Online (Sandbox Code Playgroud) 我有一个WP8.0的工作解决方案.但我需要升级才能访问WNS.我已成功将WNS添加到主菜单中的升级解决方案中.但在升级到wp8.1(silverlight)之后,我遇到了一些奇怪的错误,这只发生在运行时.作为示例,它发生在以下usercontrol中:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"
xmlns:View="clr-namespace:ShieldGenerator.View"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
x:Class="ShieldGenerator.View.MoveableShieldGear"
mc:Ignorable="d"
Canvas.Left="{Binding Gear.x}" Canvas.Top="{Binding Gear.y}" Canvas.ZIndex="{Binding Gear.z}" >
<Path Data="{Binding Gear.Path}" Fill="{Binding Gear.Color}" Stretch="Fill" UseLayoutRounding="False" Height="{Binding Gear.Height}" Width="{Binding Gear.Width}" Opacity="{Binding Gear.Opacity}">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="{Binding Gear.Scale}" ScaleY="{Binding Gear.Scale}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}"/>
<RotateTransform Angle="{Binding Gear.Rotate}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}" />
<SkewTransform AngleX="{Binding Gear.SkewX}" AngleY="{Binding Gear.SkewY}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}" />
</TransformGroup>
</Path.RenderTransform>
<i:Interaction.Triggers>
<i:EventTrigger EventName="ManipulationStarted">
<cmd:EventToCommand Command="{Binding MouseDownGearCommand}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
<i:EventTrigger EventName="ManipulationDelta">
<cmd:EventToCommand Command="{Binding MouseGearMoveCommand, Mode=OneWay}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
<i:EventTrigger …Run Code Online (Sandbox Code Playgroud) 尝试从控制台应用程序写入事件日志时,我不断收到此错误消息.这是我写给它的方式
public static void WriteToEventLog(Exception ex)
{
string mySource = "Export Task";
if (!EventLog.SourceExists(mySource))
EventLog.CreateEventSource(mySource, "Application");
EventLog myLog = new EventLog();
myLog.Source = mySource;
myLog.WriteEntry(ex.ToString());
}
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会这样,以及我如何解决它?
我的应用程序崩溃一旦它打开,毫无例外它工作正常但突然我遇到了这个问题.在输出控制台上我得到以下内容:
'AgHost.exe' (CoreCLR: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AgHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.RuntimeHost.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AgHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AgHost.exe' (CoreCLR: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Net.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just …Run Code Online (Sandbox Code Playgroud)