概要
protected override async void Execute() { Exception exception = null; var result = await System.Threading.Tasks.Task.Run ( () => { try { var catalogs = new List<IResourceLocator>( m_DepOp.Result.Count ); for ( int i = 0; i < m_DepOp.Result.Count; i++ ) { var locator = m_DepOp.Result[ i ].Result as IResourceLocator; string localHash = null; IResourceLocation remoteLocation = null; if ( locator == null ) { var catData = m_DepOp.Result[ i ].Result as ContentCatalogData; locator = catData.CreateCustomLocator( catData.location.PrimaryKey ); localHash = catData.localHash; remoteLocation = catData.location; } m_LocatorInfos[ i ].UpdateContent( locator, localHash, remoteLocation ); catalogs.Add( m_LocatorInfos[ i ].Locator ); } return catalogs; } catch ( NullReferenceException e ) { exception = e; return null; } } ); Complete( result, exception == null, exception?.ToString() ); }
UpdateCatalogsOperation.cs の UpdateCatalogsOperation.Execute で
NullReferenceException が発生したら例外を投げるのではなく
Complete で success に false を渡すようにすると
通信環境が悪いなどの理由でリモートカタログのダウンロードに失敗した場合に
進行不能にならずに済む