I'm using the MIP SDK to label it as C#. As I implemented and tested the feature, the CommitAsync function generated hang, so I couldn't process it. What should I check? I also post the MIP SDK log. Currently, it's stopped in the log I attached and there's no action. I use MIP SDK version 1.14.128, .NET Framework 4.8 and Window10
Info 2025-03-19 10:13:41.730 file_handler_impl.cpp:851 TestApp (27184) "Starting API call: file_commit_async scenarioId=dd1a9f2e-89e1-4361-8058-731199f724bd" mipns::FileHandlerImpl::CommitAsync 32948
Trace 2025-03-19 10:13:41.731 default_task_dispatcher_delegate.cpp:83 TestApp (27184) "Executing task 'ApiObserver-6' on a new detached thread" mipns::DefaultTaskDispatcherDelegate::ExecuteTaskOnIndependentThread 32948
Info 2025-03-19 10:13:41.731 file_handler_impl.cpp:851 TestApp (27184) "Ended API call: file_commit_async" mipns::FileHandlerImpl::CommitAsync 32948
Info 2025-03-19 10:13:41.731 file_handler_impl.cpp:851 TestApp (27184) "Starting API task: file_commit_async scenarioId=dd1a9f2e-89e1-4361-8058-731199f724bd" mipns::FileHandlerImpl::CommitAsync 19140
Info 2025-03-19 10:13:41.731 file_format_base.cpp:160 TestApp (27184) "Protection from input: [****]" mipns::FileFormatBase::GetProtection 19140
Info 2025-03-19 10:13:41.731 file_handler_impl.cpp:1079 TestApp (27184) "Added [6] properties and removed:[0] properties" mipns::FileHandlerImpl::CommitImpl 19140
Trace 2025-03-19 10:13:41.731 std_stream.cpp:95 TestApp (27184) "Creating output stream on: ********************" mipns::StdStream::CreateNew 19140
Info 2025-03-19 10:13:41.733 file_handler_impl.cpp:1121 TestApp (27184) "Applying template protection by label action" mipns::FileHandlerImpl::PrepareProtectionHandler 19140
Info 2025-03-19 10:13:41.734 protection_engine_impl.cpp:1127 TestApp (27184) "Starting API call: protection_engine_create_publishing_protection_handler" mipns::ProtectionEngineImpl::CreateProtectionHandlerForPublishing 19140
Info 2025-03-19 10:13:41.734 protection_engine_impl.cpp:1127 TestApp (27184) "Starting API task: protection_engine_create_publishing_protection_handler" mipns::ProtectionEngineImpl::CreateProtectionHandlerForPublishing 19140
Info 2025-03-19 10:13:41.734 service_discovery_helper.cpp:177 TestApp (27184) "Using cloud endpoint base url domain '' for service discovery" mipns::ServiceDiscoveryHelper::GetServiceDetailsWithLicense 19140
Info 2025-03-19 10:13:41.734 service_discovery_helper.cpp:201 TestApp (27184) "No redirected url found. DNS will be checked" mipns::ServiceDiscoveryHelper::GetServiceDetailsWithLicense 19140
Trace 2025-03-19 10:13:41.734 dnsinfo_store.cpp:68 TestApp (27184) "+DnsInfoStore::FindDnsResult" mipns::DnsInfoStore::FindDnsResult 19140
Trace 2025-03-19 10:13:41.734 persistent_store_impl.cpp:126 TestApp (27184) "PersistentStoreImpl::Find: Trying to find rows for table: DnsInfoStore started" mipns::PersistentStoreImpl::Find 19140
Trace 2025-03-19 10:13:41.734 sqlite_storage_table.cpp:186 TestApp (27184) "SQLiteStorageTable::Find: Trying to find rows for table: DnsInfoStore" mipns::SQLiteStorageTable::Find 19140
Trace 2025-03-19 10:13:41.735 sqlite_storage_table.cpp:213 TestApp (27184) "Found no matching rows." mipns::SQLiteStorageTable::Find 19140
Trace 2025-03-19 10:13:41.735 persistent_store_impl.cpp:136 TestApp (27184) "PersistentStoreImpl::Find: Trying to find rows for table: DnsInfoStore completed" mipns::PersistentStoreImpl::Find 19140
Trace 2025-03-19 10:13:41.735 dnsinfo_store.cpp:78 TestApp (27184) "-DnsInfoStore::FindDnsResult" mipns::DnsInfoStore::FindDnsResult 19140
Info 2025-03-19 10:13:41.735 service_discovery_helper.cpp:219 TestApp (27184) "No cached DNS entry found" mipns::ServiceDiscoveryHelper::GetServiceDetailsWithLicense 19140
Info 2025-03-19 10:13:41.735 service_discovery_helper.cpp:254 TestApp (27184) "Service Details Domain: ; mipns::ServiceDiscoveryHelper::GetServiceDetailsWithLicense 19140
Info 2025-03-19 10:13:41.735 service_discovery_helper.cpp:255 TestApp (27184) "Service Details DNS-resolved URL: ; mipns::ServiceDiscoveryHelper::GetServiceDetailsWithLicense 19140
Info 2025-03-19 10:13:41.735 service_discovery_helper.cpp:279 TestApp (27184) "Service Details Endpoint Type: Azure RMS" mipns::ServiceDiscoveryHelper::GetServiceDetailsWithLicense 19140
Info 2025-03-19 10:13:41.735 service_discovery_helper.cpp:289 TestApp (27184) "Service discovery disabled. Using default service URLs" mipns::ServiceDiscoveryHelper::FindCachedServiceDiscoveryDetails 19140
Trace 2025-03-19 10:13:41.735 json_serializer_impl.cpp:420 TestApp (27184) " +JsonSerializer::SerializePublishUsingTemplateRequest" mipns::JsonSerializer::SerializePublishUsingTemplateRequest 19140
Trace 2025-03-19 10:13:41.735 json_serializer_impl.cpp:473 TestApp (27184) " -JsonSerializer::SerializePublishUsingTemplateRequest" mipns::JsonSerializer::SerializePublishUsingTemplateRequest 19140
Info 2025-03-19 10:13:41.736 protection_http_provider.cpp:45 TestApp (27184) "/[email protected] is auto-approved and requires no user consent." mipns::ProtectionHttpProvider::RequestUserConsent 19140
Trace 2025-03-19 10:13:41.736 persistent_store_impl.cpp:126 TestApp (27184) "PersistentStoreImpl::Find: Trying to find rows for table: AuthInfoStore started" mipns::PersistentStoreImpl::Find 19140
Trace 2025-03-19 10:13:41.736 sqlite_storage_table.cpp:186 TestApp (27184) "SQLiteStorageTable::Find: Trying to find rows for table: AuthInfoStore" mipns::SQLiteStorageTable::Find 19140
Trace 2025-03-19 10:13:41.736 persistent_store_impl.cpp:136 TestApp (27184) "PersistentStoreImpl::Find: Trying to find rows for table: AuthInfoStore completed" mipns::PersistentStoreImpl::Find 19140
Info 2025-03-19 10:13:41.736 auth_info_store.cpp:76 TestApp (27184) "Found OAuth2 challenge in cache. Domain: api.aadrm IssuerId: '' Challenge: 'Bearer resource="";", realm="""", authorization="";"'" mipns::AuthInfoStore::FindChallenge 19140
Trace 2025-03-19 10:13:41.736 protection_auth_challenge_provider.cpp:223 TestApp (27184) "Trimming '/oauth2/authorize' from authority ''" mipns::ProtectionAuthChallengeProvider::GetChallengeFromAuthHeader 19140
Trace 2025-03-19 10:13:41.736 protection_auth_challenge_provider.cpp:223 TestApp (27184) "Trimming '/oauth2/authorize' from authority ''" mipns::ProtectionAuthChallengeProvider::GetChallengeFromAuthHeader 19140
Info 2025-03-19 10:13:41.737 auth_request_transformer.cpp:155 TestApp (27184) "Requesting auth token from app. Resource: '', Authority: '', Scope: '', Claims: ''" mipns::AuthRequestTransformer::GetAuthToken 19140
Info 2025-03-19 10:13:41.737 auth_request_transformer.cpp:169 TestApp (27184) "Authentication response time (seconds): 0.0001799" mipns::AuthRequestTransformer::GetAuthToken 19140
Trace 2025-03-19 10:13:41.738 http_client_base.cpp:80 TestApp (27184) "Adding HTTP operation '719334db-a684-4204-9ca9-d2fb92613619'" mipns::HttpClientBase::AddOperation 19140
Trace 2025-03-19 10:13:41.789 gsf_utils.cpp:29 TestApp (27184) "Collecting capable appnames: 16ms
Allocating hashtables:...... 0ms
Reading capable apps: 812ms
Reading URL associations:... 47ms
Reading extension assocs: 860ms
Reading exe-only apps:...... 343ms
Reading classes: 2594ms
Reading UWP apps: 2891ms
Postprocessing:..............15ms
TOTAL: 7578ms" `anonymous-namespace'::GsfLogHandler 24096
Trace 2025-03-19 10:13:42.487 http_client_base.cpp:92 TestApp (27184) "Removing HTTP operation 'OneDS_HTTP-2'" mipns::HttpClientBase::RemoveOperation 25680
Info 2025-03-19 10:13:42.487 http_client_base.cpp:44 TestApp (27184) "HTTP response time (seconds): 1.12662 ID: OneDS_HTTP-2" mipns::HttpClientBase::SendAsync::<lambda_bbfd2e2e0e3cff79745408d7f010e245>::operator () 25680
Trace 2025-03-19 10:13:42.487 default_task_dispatcher_delegate.cpp:95 TestApp (27184) "Cancelling task 'OneDS_Task-5' if not yet started" mipns::DefaultTaskDispatcherDelegate::CancelTask 25680
Trace 2025-03-19 10:13:42.487 default_task_dispatcher_delegate.cpp:58 TestApp (27184) "Dispatching task 'OneDS_Task-6' to event loop" mipns::DefaultTaskDispatcherDelegate::DispatchTask 25680
Trace 2025-03-19 10:13:42.487 oneds_impl.cpp:216 TestApp (27184) "Executing OneDS task 'OneDS_Task-6'" mipns::DoTaskDispatcherQueue::<lambda_d4d148ccfa8086e2b0a90ea9e7726597>::operator () 33684
Trace 2025-03-19 10:13:42.488 http_client_base.cpp:80 TestApp (27184) "Adding HTTP operation 'OneDS_HTTP-3'" mipns::HttpClientBase::AddOperation 33684
I tried modifying the code because I was wondering if the UI thread was related, but there was no change.
This is my code. There may be some omissions in the code.
// ConverterForm.cs
private async void convertButton_Click(object sender, EventArgs e)
{
Log.Debug($"Selected convert type is {convertType}...");
convertButton.Enabled = false;
infoButton.Enabled = false;
progressBar.Value = 0;
var progress = new Progress<(int, int, string, string, string)>(value =>
{
progressBar.Value = value.Item1;
UpdateFileStatus(value.Item2, value.Item3, value.Item4, value.Item5);
});
await ConvertFilesAsync(progress);
MessageBox.Show(ResourceHelper.GetLocalizedString("SuccessConverterMessage"), "MessageBox");
mipManager.Shutdown();
//Close();
}
private Task ConvertFilesAsync(IProgress<(int, int, string, string, string)> progress)
{
return Task.Run(async () =>
{
for (int i = 0; i < FileList.Count; i++)
{
string curPath = FileList[i];
ConvertResultVo convertResultVo = new ConvertResultVo();
if (convertType == "AType")
{
try
{
convertResultVo = await BToA(curPath, i);
}
catch (Exception ex)
{
Log.Error($"BToA Convert Error: {ex.Message}");
}
}
else if (convertType == "BType")
{
try
{
convertResultVo = await AToB(curPath, i);
}
catch (Exception ex)
{
Log.Error($"AToB Convert Error: {ex.Message}");
}
}
else
{
Log.Error("Invalid Convert Type");
continue;
}
progress.Report((i + 1, i, convertResultVo.OrgType, convertResultVo.Status, convertResultVo.Description));
}
});
}
private async Task<ConvertResultVo> BToA(string filePath, int index)
{
Log.Debug($"Target File Path: {filePath}");
FileInfo fileInfo = new FileInfo(filePath);
ConvertResultVo convertResultVo = new ConvertResultVo();
convertResultVo.filePath = filePath;
convertResultVo.fileName = fileInfo.Name;
convertResultVo.OrgType = "";
if (fileInfo.Length > maxFileSizeInBytes)
{
convertResultVo.Status = ResourceHelper.GetLocalizedString("FailConvertText");
convertResultVo.Description = ResourceHelper.GetLocalizedString("FailConvertAipDescText") + " " + ResourceHelper.GetLocalizedString("MaxFileSizeOverMessage");
return convertResultVo;
}
MipPropertyUtil mipPropertyUtil = MipPropertyUtil.Instance;
string ownerEmail = GetOwnerEmail(filePath);
try
{
FileVo setLabelResult = await mipManager.SetLabel(filePath, ownerEmail, encryptFileInfo);
if (setLabelResult.ResultStatus == "SUCCESS")
{
convertResultVo.Status = ResourceHelper.GetLocalizedString("SuccessConvertText");
convertResultVo.Description = ResourceHelper.GetLocalizedString("SuccessConvertDescText");
Log.Debug("Successfully converted AIP File.");
setLabelResult.FilePath = filePath;
setLabelResult.FileName = Path.GetFileName(filePath);
return convertResultVo;
}
else
{
if (setLabelResult.ResultStatus == "PASS")
{
convertResultVo.Status = ResourceHelper.GetLocalizedString("NotTargetText");
convertResultVo.Description = $"{setLabelResult.ResultMessage}";
}
else
{
convertResultVo.Status = ResourceHelper.GetLocalizedString("FailConvertText");
convertResultVo.Description = ResourceHelper.GetLocalizedString("FailConvertAipDescText") + $" {setLabelResult.ResultMessage}";
}
Log.Error($"Failed to converted AIP File. Result message:{setLabelResult.ResultMessage}");
setLabelResult.FilePath = filePath;
setLabelResult.FileName = Path.GetFileName(filePath);
sendCollectFile(setLabelResult, mipPropertyUtil.GetValue("KeyrkeUrl"), "APPLY");
return convertResultVo;
}
}
catch (Exception ex)
{
Log.Error($"SetLabel Error: {ex.Message}");
convertResultVo.Status = ResourceHelper.GetLocalizedString("FailConvertText");
convertResultVo.Description = ResourceHelper.GetLocalizedString("ErrorApplyLabelDescText");
return convertResultVo;
}
}
//MipManager.cs
private async Task<CreateFileHandlerReturnVo> CreateFileHandlerAsync(string filePath)
{
Log.Debug($"CreateFileHandler start:{filePath}");
bool isDke = false;
string failDesc = null;
Log.Debug($"IFileHandler Task start:{filePath}");
IFileHandler iFileHandler = null;
try
{
if (fileEngine == null)
{
return null;
}
Log.Debug($"Create IFileHandler start");
iFileHandler = await fileEngine.CreateFileHandlerAsync(filePath, filePath, true);
Log.Debug($"Create IFileHandler end");
break;
}
catch (NetworkException ne)
{
Log.Error($"Network Error in CreateFileHandlerAsync: {ne.Category} | message: {ne.Message}");
continue;
}
catch (Exception ex)
{
Log.Debug($"Create IFileHandler except start");
if (ex.Message.StartsWith("NotSupportedError: Double key"))
{
Log.Error($"NotSupported DKE Error: {filePath}");
isDke = true;
failDesc = "DKE encrypted data.";
}
else
{
Log.Error(ex.Message);
Log.Error($"CreateFileHandlerAsync Error: {filePath}");
failDesc = ex.Message;
}
Log.Debug($"Create IFileHandler except end");
break;
}
}
Log.Debug($"IFileHandler Task end");
Log.Debug($"CreateFileHandler end:{filePath}");
Log.Debug($"CreateFileHandlerReturnVo start...");
CreateFileHandlerReturnVo vo = new CreateFileHandlerReturnVo
{
FileHandler = iFileHandler,
IsDKE = isDke,
FailDesc = failDesc
};
Log.Debug($"CreateFileHandlerReturnVo end...");
return vo;
}
public async Task<FileVo> SetLabel(string filePath, string ownerEmail, EncryptFileInfo encryptFileInfo)
{
Log.Debug($"Called setLabel: {filePath}");
CreateFileHandlerReturnVo returnVo = await CreateFileHandlerAsync(filePath).ConfigureAwait(false);
try
{
UserDataVo userDataVo = MipAgentDataUtil.Instance.userDataVo;
ProtectionSettings protectionSettings = new ProtectionSettings()
{
DelegatedUserEmail = string.IsNullOrWhiteSpace(ownerEmail) ? userDataVo.DecUserEmail : ownerEmail
};
fileHandler.SetLabel(fileEngine.GetLabelById(labelVo.ApplyLabelId), labelingOptions, protectionSettings);
}
catch (AdhocProtectionRequiredException apre)
{
Log.Error($"AdhocProtectionRequiredException: {filePath}");
return fileVo;
}
catch (BadInputException bie)
{
Log.Error($"BadInputException: {filePath}");
return fileVo;
}
catch (Exception e)
{
Log.Error($"UnexpectedException - {filePath}: {e.Message} ");
return fileVo;
}
try
{
result = await fileHandler.CommitAsync(tempPath);
break;
}
catch (NotSupportedException)
{
Log.Error($"Not supported format: {filePath}");
break;
}
catch (NetworkException ne)
{
Log.Error($"Network Error in CommitAsync: {ne.Category} | message: {ne.Message}");
continue;
}
}
On the log, it stops at CommitAsync. Is there anything I should try?