1 2 Previous Next 16 Replies Latest reply: Nov 5, 2012 9:57 AM by Ron M-Oracle Go to original post RSS
      • 15. Re: NullReferenceException error
        Hai Ha
        nope, that still didn't fix it. i supplied the baseSpec (i.e. x) into SpecWorkflowTagEvaluator.IsSpecApproved() and it still had a NullReferenceException. stack trace below.

        Code now looks like this...
        var formulationSpecs = (new ArrayList(specSections)
        .Cast<IEntityViewerSection>()
        .SelectMany(entityViewerSection => entityViewerSection.Items.Cast<IEntityViewerItem>(),
        (entityViewerSection, item) => PdmGateway.GetBaseSpecByPkid(item.PKID))
        .Where(x => x is IFormulationSpecification)
        .Where(x => SpecWorkflowTagEvaluator.IsSpecApproved(x)))
        .ToArray();

        Stack Trace:
        at Xeno.Prodika.GSMLib.Utils.GSMUtilityFunctions.IsSpecApproved(ISpecificationService specService)
        at Oracle.Agile.PlmProcess.PLM4PExtensionUtils.Workflow.SpecWorkflowTagEvaluator.IsSpecApproved(IBaseSpec baseSpec)
        at Tyson.Pdm.Validator.Lib.ScrmValidators.ScrmRestrictedIngredientsValidator.<Validate_Internal>b__3(IBaseSpec x) in c:\PDMProjects\Prodika.Extensions\Dev\Trunk\Tyson.Pdm.Validator.Lib\ScrmValidators\ScrmRestrictedIngredientsValidator.cs:line 68
        at System.Linq.Enumerable.<>c__DisplayClassf`1.<CombinePredicates>b__e(TSource x)
        at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
        at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
        at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
        at Tyson.Pdm.Validator.Lib.ScrmValidators.ScrmRestrictedIngredientsValidator.Validate_Internal(IValidationContext ctx, Object propVal) in c:\PDMProjects\Prodika.Extensions\Dev\Trunk\Tyson.Pdm.Validator.Lib\ScrmValidators\ScrmRestrictedIngredientsValidator.cs:line 63
        • 16. Re: NullReferenceException error
          Ron M-Oracle
          I see. It looks like the IsSpecApproved method can only be used at certain times, having to do with the spec service being available or not.
          I would change it to use a different method instead:
          SpecWorkflowTagEvaluator.IsSpecInWorkflowStatusByTagID(baseSpec, new List<int>() { 4 })
          where 4 is the behaviorID of IsApproved workflow tag, though you can replace that with any other required tags, or a comma delimited list of behaviorIDs.
          1 2 Previous Next