我想使用StringFormat做这样的事情:
<Label x:Name="myLabel">
<Label.Content>
<Multibinding StringFormat="{}{0} - {1}">
<Binding Path="Lib1" />
<Binding Path="Lib2" />
</MultiBinding>
</Label.Content>
</Label>
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用,我得到了这个错误:
MultiBinding失败,因为它没有有效的Converter.MultiBindingExpression:目标元素是'Label'(Name ='myLabel'); target属性是'Content'(类型'Object')
有没有办法使这个代码工作?
有人可以向我解释为什么当我在x86平台上执行它以及为什么它在x64上失败时这段代码表现良好?
结果:
如果我改变某些东西,比如删除一个未使用的变量,或者如果我在p_lFirstId ++之后删除无用的for循环,那么奇怪的行为就会消失.
我发现在我的发布配置中将"pdb-only"更改为"full",它再次起作用.
如果您直接从visual studio运行代码,它也表现良好.
这是JIT Compiler的错误吗?
先感谢您.
class Program
{
static void Main(string[] args)
{
Test(null, null, null, 0, 1);
}
public static void Test(
List<string> liste, List<string> unused1,
string unused2, int unused3, long p_lFirstId)
{
liste = new List<string>();
StringBuilder sbSql = new StringBuilder();
for (int i = 0 ; i < 10 ; i++)
{
sbSql.Append(p_lFirstId);
p_lFirstId++;
foreach (string sColonne in liste)
{
}
}
System.Console.WriteLine(sbSql.ToString());
}
}
Run Code Online (Sandbox Code Playgroud) 我在这个网站上阅读了一些内容:
我用Ninject.如果我理解这些建议,就必须:
这看起来很奇怪,特别是对工厂来说 我有很多项目使用相同的库.所有这些项目是否应该重新定义ninject模块和工厂?
你怎么看 ?
每次我在Staging和Production之间交换部署时,都会遇到这种错误:
[Wed Oct 09 18:43:51.9519 +00:00 2013] [错误] [Zappiti.BaseApi]更新条目时发生错误.有关详细信息,请参阅内部异常
System.Data.Entity.Infrastructure.DbUpdateException:更新条目时发生错误.有关详细信息,请参阅内部异常 ---> System.Data.UpdateException:更新条目时发生错误.有关详细信息,请参阅内部异常 ---> System.Data.SqlClient.SqlException:从服务器接收结果时发生传输级错误.(提供者:会话提供者,错误:19 - 物理连接不可用)
在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,Boolean breakConnection,Action`1 wrapCloseInAction)
在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose)
在System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj,UInt32错误)
在System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
在System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
在System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
在System.Data.SqlClient.TdsParserStateObject.TryReadByte(字节和值)
在System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,Boolean&dataReady)
在System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString)
在System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async,Int32 timeout,Task&task,Boolean asyncWrite)
在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String方法,TaskCompletionSource`1完成,Int32超时,任务和任务,布尔asyncWrite)
在System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1完成,String methodName,Boolean sendToPipe,Int32 timeout,Boolean asyncWrite)
在System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
在System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator转换器,EntityConnection连接,Dictionary
2 identifierValues, List
1 generatedValues)在System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager,IEntityAdapter adapter)
---内部异常堆栈跟踪结束---
在System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager,IEntityAdapter adapter)
在System.Data.Objects.ObjectContext.SaveChanges(SaveOptions选项)
在System.Data.Entity.Internal.InternalContext.SaveChanges()
---内部异常堆栈跟踪结束---
在System.Data.Entity.Internal.InternalContext.SaveChanges()
在Zappiti.BaseApi.PutVideo(PutVideo putVideo,Guid userId,String queueName,Boolean isBeta)
我使用TFS的标准Build Definition部署我的包. …