2011-02-22 3 views

답변

0

경고는 serviceLocator이 Null입니까? 당신의 코드를 더 이상 보지 않고

, 당신은 위의 줄에

Contract.Assume(serviceLocator != null); 

을 넣을 수있는 (다른 계약 플레이에있을 수 있습니다 무엇의 아이디어를 얻을 수 있습니다).

0

아마도 serviceLocator.GetInstance<Shell>()은 인스턴스를 찾을 수없는 경우 null을 반환합니다.

해당 상황에 대한 대체 제어 흐름을 제공하십시오.

var instance = serviceLocator.GetInstance<Shell>(); 
if (instance == null) 
    throw new InvalidOperationException("Shell instance is missing."); 
HtmlPage.RegisterScriptableObject("Shell", instance); 
관련 문제