Pregunta

I am using the VersionOne SDK to write test results to an asset. However, I keep getting an exception on the first line inside this method.

Caught: "Could not find file 'C:\Users\solution\bin\Debug\client_secrets.json'." (System.IO.FileNotFoundException)  Exception Message = "Could not find file 'C:\\Users\\solution\\bin\\Debug\\client_secrets.json'.", Exception Type = "System.IO.FileNotFoundException", Exception WinRT Data = null  

Obviously it looks like the path is not using the @ symbol so the path has two slashes in it. How can I find where it is getting this path from?

class V1Tools
{

    public string TestRequest { get; set; }  
    internal EnvironmentContext Context;
    private readonly CLogger _logger;


    public V1Tools(ref DataObject masterData)
    {
        _logger = masterData.Logger;
        Context = new EnvironmentContext();
    }

    public IV1Configuration GetV1Configuration()
    {
        return Context.V1Configuration;
    }


    public void UpdateTestResults(string strTestId, string strActualResult)
    {
        var testId = Oid.FromToken(strTestId, Context.MetaModel);
        var query = new Query(testId);
        var assetType = Context.MetaModel.GetAssetType("Test");
        var addResults = assetType.GetAttributeDefinition("ActualResults");

        query.Selection.Add(addResults);
        var result = Context.Services.Retrieve(query);
        var test = result.Assets[0];
        var oldResult = GetValue(test.GetAttribute(addResults).Value);

        var time = DateTime.Now;
        const string format = "MMM ddd d HH:mm yyyy";
        test.SetAttributeValue(addResults, "<p>" + "\n" + oldResult + time.ToString(format) + "-->" + strActualResult + "</p>");
        Context.Services.Save(test);

        _logger.Log(Loglevel.Debug, test.Oid.Token, oldResult, GetValue(test.GetAttribute(addResults).Value));

    }

I'm using the following in the App.config file to set the username and password:

<appSettings>
<add key="DebugFileName" value="C:\VersionOneAPIClientDebug.txt" />
<add key="V1Url" value="https://www12.v1host.com/myVersionOneAccount/" />
<add key="V1UserName" value="myUserName" />
<add key="V1Password" value="myPassWord" />
<add key="UseWindowsIntegratedAuth" value="false" />
<add key="ClientSettingsProvider.ServiceUri" value="" />

¿Fue útil?

Solución

The problem is related to Caught Exception. There are 2 things happening at the same time. First, you have checked this property in

Visual Studio Exceptions (Debug -> Exceptions -> Common Language Runtime Exception "Checked").

This option in VS stops code execution, even though they are properly handled. Second, the file Oauth2Client.pdb is present along with the dll that is failing.

We just refactored the code so if you get the latest version of the VersionOne.SDK.NET.APIClient you won't see the Caught Exception any more.

So the solution to this could be one of the following:

  • (preferred) Use the latest version of the VersionOne.SDK.NET.APIClient
  • Remove the pdb file.
  • Configure exceptions not to stop code execution (keep both unchecked).
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top