4
Vote

Pipeline Builder Exception

description

Hi All,
Pipeline builder doesn't work (throws exception) when one of my method in Contract assembly has generics :(.
 
T GetValue<T>(string Expression);

file attachments

comments

BladeWise wrote Dec 12, 2008 at 1:19 PM

To explain the issue further, I'm going to add a simple example exposing the problem (better, the problems) and give more informations.

First of all, the 'exception' is a compile time error and it seems that the issue is related to the fact that Pipeline Builder is not able to properly re-map generic collections of IContract elements (i.e. IEnumerable<T> : where T is IContract) or contract collections (i.e. IEnumerableContract<T> : where T is IContract) when creating the host-view and addin-view. Moreover there are even problems when dealing with the adapters generation, since the tool does not create the adapter code properly (it fails to translate the IEnumerableContract/IListContract to the proper IEnumerable/IList view).

Creating a contract library like the folowing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.AddIn.Contract;
using System.AddIn.Pipeline;
using PipelineHints;

namespace Contracts
{
[AddInBase]
public interface IMyAddin1Contract : IContract
{
    System.AddIn.Contract.Collections.IListContract<IMyElementContract> Contracts { get; }
}

[AddInBase]
public interface IMyAddin2Contract : IContract
{
    System.AddIn.Contract.Collections.IEnumerableContract<IMyElementContract> Contracts { get; }
}

[AddInBase]
public interface IMyAddin4Contract : IContract
{
    IList<IMyElementContract> Contracts { get; }
}

[AddInBase]
public interface IMyAddin5Contract : IContract
{
    IEnumerable<IMyElementContract> Contracts { get; }
}

public interface IMyElementContract : IContract
{
    string Name { get; }
}

}

and running the Pipeline Builder tool, will expose such problems (trying to build the solution will result in compiling errors, related to the incorrect translation of the collection elements).

wrote Dec 12, 2008 at 1:19 PM

wrote Dec 12, 2008 at 1:20 PM

BladeWise wrote Dec 12, 2008 at 1:25 PM

Re-reading the post, it seems that the issue I'm reporting is not exactly related to the OP one.
Both are related to generics, but those are just different issues. I will add another issue to avoid confusion.

wrote Mar 3, 2010 at 12:50 PM

wrote Feb 14, 2013 at 8:01 PM