/// <summary> /// Factory for <see cref="EvaluationContext" /> /// </summary> public static EvaluationContext Create(SharingPolicy policy) { var context = new EvaluationContext(policy); TestOnlyHookOnCreate?.Invoke(context); return(context); }
/// <summary> /// Factory for <see cref="EvaluationContext" /> /// </summary> /// <param name="policy"> The <see cref="SharingPolicy"/> to use.</param> /// <param name="fileSystem">The <see cref="IFileSystem"/> to use. /// This parameter is compatible only with <see cref="SharingPolicy.Shared"/>. /// The method throws if a file system is used with <see cref="SharingPolicy.Isolated"/>. /// The reasoning is that <see cref="SharingPolicy.Isolated"/> means not reusing any caches between evaluations, /// and the passed in <paramref name="fileSystem"/> might cache state. /// </param> public static EvaluationContext Create(SharingPolicy policy, MSBuildFileSystemBase fileSystem) { var context = new EvaluationContext( policy, fileSystem); TestOnlyHookOnCreate?.Invoke(context); return(context); }
/// <summary> /// Factory for <see cref="EvaluationContext" /> /// </summary> /// <param name="policy"> The <see cref="SharingPolicy"/> to use.</param> /// <param name="fileSystem">The <see cref="IFileSystem"/> to use. /// This parameter is compatible only with <see cref="SharingPolicy.Shared"/>. /// The method throws if a file system is used with <see cref="SharingPolicy.Isolated"/>. /// The reasoning is that <see cref="SharingPolicy.Isolated"/> means not reusing any caches between evaluations, /// and the passed in <paramref name="fileSystem"/> might cache state. /// </param> public static EvaluationContext Create(SharingPolicy policy, MSBuildFileSystemBase fileSystem) { // Unsupported case: isolated context with non null file system. // Isolated means caches aren't reused, but the given file system might cache. ErrorUtilities.VerifyThrowArgument( policy == SharingPolicy.Shared || fileSystem == null, "IsolatedContextDoesNotSupportFileSystem"); var context = new EvaluationContext( policy, fileSystem); TestOnlyHookOnCreate?.Invoke(context); return(context); }