Oh sorry
Instead of: catch{return new[]}
it should be:
{
_unsuccesfulEnd.Error(ex)
return new[]
}
And here: input.AsParallel().Select(TryExecute)
we should have: input.AsParallel().SelectMany(TryExecute)
суббота, 17 мая 2014 г., 0:51:50 UTC+2 пользователь Igor Fedurkin написал:
>
> Hello society,
> Bad news to begin with - sorry.
>
> Something like this will deadlock (pseudo language):
>
> class ListProcessor : IValueProcessor<List<TIn>, List<TOut>>
> {
> IValueProcessor<TIn, TOut> _itemProcessor;
> ILog _unsuccesfulEnd;
>
> public List<TOut> Process(List<TIn> input)
> {
> return input.AsParallel().Select(TryExecute)
> }
>
> <enumerable of TOut> TryExecute<TIn>(input)
> {
> try
> {
> return new[]{_itemProcessor.Process(input)}
> }
> catch{return new[]}
> }
> }
>
> class Test:
> expected:
> itemProcessor.Expect(Process(1)).Return("1")
> itemProcessor.Expect(Process(2)).Throw(ex)
> _unsuccesfulEnd.Error(ex)
> itemProcessor.Expect(Process(3)).Throw()
> _unsuccesfulEnd.Error(ex)
> itemProcessor.Expect(Process(4)).Return("4")
> repository.Reply()
>
> var result = [1,2,3,4].Select(sut.Process)
>
> expected: ["1", "4"]
>
> Actual result is the infinitely hanging test.
>
> Will give it another try try to debug tomorrow, but it doesn't look like a
> simple one.
>
> Any help appreciated.
>
> Regards,
> Igor
>
>
--
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.