Pergunta

I have the following code to get a list of changed files from Subversion using SharpSVN.

The code works perfectly fine from unit tests but fails when run from MSBuild. Both unit test and MSBuild are run using the same parameters (I've checked by debugging both), and are run under the same user. The error exception is raised inside GetLog, (GetInfo succeeds, and other SVN methods work else where).

Any ideas?

Code:

public IEnumerable<string> GetChangedFiles(long revisionNumber)
{
    using (var client = new SvnClient())
    {
        SvnInfoEventArgs info;
        client.GetInfo(_workingCopyPath, out info);
        var lastRevision = info.LastChangeRevision;

        Collection<SvnLogEventArgs> logItems;
        var args = new SvnLogArgs();
        args.RetrieveChangedPaths = true;
        if (revisionNumber > lastRevision)
        {
            throw new ArgumentException(string.Format(
               "Revision number ({0}) is greater than last revision ({1})",
               revisionNumber, lastRevision));
        }

        args.Range = new SvnRevisionRange(revisionNumber, lastRevision);
        client.GetLog(_workingCopyPath, args, out logItems);
        return logItems.SelectMany(li => li.ChangedPaths).Select(cp => cp.Path);
    }
}

And the exception:

System.Runtime.InteropServices.SEHException was unhandled by user code
  Message=External component has thrown an exception.
  Source=SharpSvn
  ErrorCode=-2147467259
  StackTrace:
       at svn_client_log5(apr_array_header_t* , svn_opt_revision_t* , apr_array_header_t* , Int32 , Int32 , Int32 , Int32 , apr_array_header_t* , IntPtr , Void* , svn_client_ctx_t* , apr_pool_t* )
       at SharpSvn.SvnClient.InternalLog(ICollection`1 targets, Uri logRoot, SvnRevision altPegRev, SvnLogArgs args, EventHandler`1 logHandler)
       at SharpSvn.SvnClient.Log(String targetPath, SvnLogArgs args, EventHandler`1 logHandler)
       at SharpSvn.SvnClient.GetLog(String targetPath, SvnLogArgs args, Collection`1& logItems)
       at MSBuild.CustomTasks.SVN.Svn.GetChangedFiles(Int64 revisionNumber)
       at MSBuild.CustomTasks.SVN.SvnCopy.Execute()
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
  InnerException: 
Foi útil?

Solução

I found the solution, it was quite specific to my case though.

When I deployed my CustomTask I forgot to deploy SharpSvn-SASL21-23-Win32.dll (it was there when run from the unit test).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top