Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个从 WCF 服务获取数据的 Silverlight 应用程序。一旦我收到来自服务的数据,我就会尝试将对象的实例注册到 Unity 容器,我发现它会引发ThreadSynchronizationLock异常。
ThreadSynchronizationLock
谁能帮我避免这个例外?
已知问题。RegisterInstance 方法(实际上是 ContainerControlledLifetimeManager)将尝试释放它在执行 RegisterInstance 时没有的锁。这实际上是第一次机会异常,已在代码库中正确处理,并且仅显示在调试器中。
基本上,您不需要避免它,它已经在代码中正确处理。
另外,我的理解是,在 Unity 3.0 中改变了这种行为,以避免这些问题。:-)