Minor annoyance in CodeGen

Mar 28, 2008 at 10:23 AM
Edited Mar 28, 2008 at 10:24 AM
Hi,

Sorry if this has been mentioned already - I couldn't see it if it has.

After using the pipeline builder I have to go and fix up references in the generated adapters. Here's an example. Here is one of my contracts:
[AddInContract]
public interface IHostContract : IContract
{
	void Register(IServiceContract service, Type serviceType);
	IServiceContract Resolve(Type serviceType);
}
This is generated for my IHost contract->view adapter:
public void Register(IService service, System.Type serviceType)
{
    ...
}
public IService Resolve(System.Type serviceType)
{
    ...
}
However, the IService references doesn't resolve until I qualify them as Contract.AddInViews.IService. Any chance we could get this fixed?

Thanks,
Kent
Mar 28, 2008 at 11:45 AM
FYI, I created an issue for this problem here.
Mar 28, 2008 at 9:43 PM
Can you upload the exact error message you get from the (I assume) compiler that is preventing this from resolving?

Can you also include the code for a small contract assembly that repros this? I tried the pipeline builder on the contract above (I made up my own IServiceContract since it isn't specified above) and I didn't run into any problems.

Thanks,
Jesse
Mar 29, 2008 at 6:43 AM
Hi,
I have the same problem both with add and host adapters.

Here is the compiler error:
Error 6 The type or namespace name 'IHost' could not be found (are you missing a using directive or an assembly reference?) <long path>\Source\HostSideAdapters\Generated Files\IActionAddInContractToViewHostAdapter.g.cs 45 32 HostSideAdapters

Here is the generated adapter form which the error comes:

namespace Contracts.HostSideAdapters
{

System.AddIn.Pipeline.HostAdapterAttribute()
public class IActionAddInContractToViewHostAdapter : Contracts.HostViews.IActionAddIn
{
private Contracts.IActionAddInContract _contract;
private System.AddIn.Pipeline.ContractHandle _handle;
static IActionAddInContractToViewHostAdapter()
{
}
public IActionAddInContractToViewHostAdapter(Contracts.IActionAddInContract contract)
{
_contract = contract;
_handle = new System.AddIn.Pipeline.ContractHandle(contract);
}
public System.Windows.FrameworkElement SettingsUI
{
get
{
return System.AddIn.Pipeline.FrameworkElementAdapters.ContractToViewAdapter(_contract.SettingsUI);
}
}
public System.Windows.FrameworkElement AddInUI
{
get
{
return System.AddIn.Pipeline.FrameworkElementAdapters.ContractToViewAdapter(_contract.AddInUI);
}
}
public void TakeAction(string detectionAddIn, System.Collections.Generic.IList<IDetectedPoint> detectedPoints)
{
_contract.TakeAction(detectionAddIn, System.AddIn.Pipeline.CollectionAdapters.ToIListContract<Contracts.HostViews.IDetectedPoint, Contracts.IDetectedPointContract>(detectedPoints, Contracts.HostSideAdapters.IDetectedPointHostAdapter.ViewToContractAdapter, Contracts.HostSideAdapters.IDetectedPointHostAdapter.ContractToViewAdapter));
}
public void Initialize(IHost hostObject)
{
_contract.Initialize(Contracts.HostSideAdapters.IHostHostAdapter.ViewToContractAdapter(hostObject));
}
public void Shutdown()
{
_contract.Shutdown();
}
internal Contracts.IActionAddInContract GetSourceContract()
{
return _contract;
}
}
}

Here is the generated hos view:

namespace Contracts.HostViews
{

public interface IHost
{
IServiceManager Services
{
get;
}
}
}

and here is the contract:

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

namespace Contracts
{
public interface IHostContract : IContract
{
IServiceManagerContract Services
{
get;
}
}
}

I hope these will help identify and fix the issue easily.

Greetings,
Yordan
Mar 29, 2008 at 3:36 PM
Thanks Yordan. Jesse, can you confirm whether this is sufficient information to repro the issue? If not, I can post my POC project...

Regards,
Kent
Mar 31, 2008 at 6:23 PM
I'm still not able to reproduce this. Can you post the project for your contract assembly?

Are you two using the latest (March) release of the PipelineBuilder? I fixed a lot of bugs specifically around namespaces in the host adapters in that release so if you're using an older one that could be the problem.

Thanks,
jesse
Apr 1, 2008 at 9:22 AM
Hi Jesse, I emailed you via the CodePlex contact function.

Regards,
Kent

PS. Definitely on the latest version.
Apr 2, 2008 at 4:23 AM
Thanks for helping me out with this guys. I was able to track down the problem and the latest check-in fixes it. I'll include this in the next binary release as well. For more info see: CodeGen References Problem.
Apr 2, 2008 at 7:43 PM
I'm glad to hear that you found the problem.
Keep up the good work.