TaskLogger.LogException C# (CSharp) Method

LogException() public method

public LogException ( string file, Exception, exception ) : void
file string
exception Exception,
return void
    public override void LogException(string file, Exception exception)
    {
        _task.Log.LogErrorFromException(exception, true, true, file);
        Success = false;
    }

Usage Example

Ejemplo n.º 1
0
        List <string> GetProjectsToBeSkiped()
        {
            string notSupportedErrorFormat = @"Unable to execute skipping tests on following directory '{0}'";

            List <string> ScopedProjects = new List <string>();

            // We will not skip broad build scope (e.g. sdk), the idea is to not to skip all the tests in a broader build scope.
            if (BuildScope.Equals("sdk", StringComparison.OrdinalIgnoreCase))
            {
                TaskLogger.LogException <NotSupportedException>(notSupportedErrorFormat, BuildScope);
            }
            else if (BuildScopes.Equals("sdk", StringComparison.OrdinalIgnoreCase))
            {
                TaskLogger.LogException <NotSupportedException>(notSupportedErrorFormat, BuildScope);
            }
            else
            {
                string sdkRootDirPath = Path.Combine(RepositoryRootDirPath, "sdk");

                CategorizeSDKProjectsTask catProj = new CategorizeSDKProjectsTask(RepositoryRootDirPath, BuildScope, null, ProjectType, ProjectCategory);
                catProj.BuildScopes = BuildScopes;
                catProj.Execute();

                if (catProj.MultipleScopes.Contains("sdk"))
                {
                    TaskLogger.LogException <NotSupportedException>(notSupportedErrorFormat, sdkRootDirPath);
                }
                else
                {
                    var sdkProj  = catProj.SDK_Projects.Select <SDKMSBTaskItem, string>((item) => item.ItemSpec);
                    var testProj = catProj.Test_Projects.Select <SDKMSBTaskItem, string>((item) => item.ItemSpec);

                    if (sdkProj.NotNullOrAny <string>())
                    {
                        ScopedProjects.AddRange(sdkProj.ToList <string>());
                    }

                    if (testProj.NotNullOrAny <string>())
                    {
                        ScopedProjects.AddRange(testProj.ToList <string>());
                    }
                }
            }

            return(ScopedProjects);
        }