Multiterm InvalidCredentialsException Error while running file verification task in studio 2017 when credentials are added through API

In Studio 2015 we were adding multiterm credentials programmatically in below format during file verification step to avoid multiterm invalid login details error.

In Studio 2017, if file is opened in editor and has changes, the file verification gives multi-term error though the credentials are still being added dynamically.

The user credentials are valid for the specified server.

How can we avoid Multiterm InvalidCredentialsException error during file verification step ?

 

Code Snippet:

fbProject.Credentials.AddCredential(new Uri("termbase." + mdTransProvider.ServerUri),

false, mdTransProvider.UserName, mdTransProvider.Password);

fbProject.Save(); // Save SDL project.

 

Regards,

Keshav Heda