Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I posted an issue on SP Guidance tracker after quite some searching, but I saw several unanswered issues there so I'm trying here as well.

I think I have a very simple Proof Of Concept: a Sandbox 2010 solution, a coded web part asking for a string from a service, a feature receiver registering the service implementation at site level during activation (or install) time.

As soon as I try to get the service instance in web part CreateChildControls, I incur into this System.Runtime.Remoting.RemotingException: Failed to write to an IPC Port: The pipe is being closed. In a previous - more complex - try I was having the same exception but for a Tcp channel protocol violation: expecting preamble,and that was even during feature activation.

From the stack trace, I can see that SPUserCodeApplicationHostAppDomainRef.Execute is looking for a SPResource.GetString, and that causes reflection (?) to kick in with Activator.CreateInstance. From this stems some SPResource_SubsetProxy, which involves some proxy and then an Ipc.IpcClientTransportSink.ProcessMessage follows.

Has anyone met anything like this?

My dev box has Windows 7 64bit, SP Foundation 2010.

Edit

Of course all of this does not happen if I try with a Farm solution (and in feature activation I register mapping at site level with properties.Feature.Parent, instead of properties.UserCodeSite)

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

Looks like this could be an actual bug. Did you ever get this resolved?

MSHotFix

share|improve this answer
    
Thanks for the info! And no, I did not manage to resolve that. In the end I had to dump ServiceLocator and all that library altogether :( –  superjos Jul 20 '12 at 7:21
add comment

I know this is an old post, but I was having this exact problem with a custom sandbox web part I am developing and it was a real pain to solve. I believe this is caused when there is a static reference to a SPList or SPListItem object.

A simplified version of the class that was causing this error:

class SomeClass
{
    private SPList List;
    private SPListItem ListItem;

    private static SomeClass _Instance;
    public static SomeClass Instance
    {
        get
        {
            if (_Instance == null) {
                _Instance = new SomeClass();
            }
            return _Instance;
        }
    }

    private SomeClass()
    {
        List = SPContext.Current.Web.GetList("/Lists/SomeList");
        ListItem = List.GetItemById(SPContext.Current.ItemId);
        // other initialisation code.
    }
}

This worked the very first time I loaded the web part, but after that it always errored out with System.Runtime.Remoting.RemotingException: Failed to write to an IPC Port: The pipe is being closed.

Then I changed the class to not store any SPList or SPListItem references:

class SomeClass
{
    private SPList List
    {
        get
        {
            return SPContext.Current.Web.GetList("/Lists/SomeList");
        }
    }
    private SPListItem ListItem
    {
        get
        {
            return List.GetItemById(SPContext.Current.ItemId);
        }
    }

    private static SomeClass _Instance;
    public static SomeClass Instance
    {
        get
        {
            if (_Instance == null) {
                _Instance = new SomeClass();
            }
            return _Instance;
        }
    }

    private SomeClass()
    {
        // other initialisation code.
    }
}

Now the web part works every time. Curiously the first version worked on my local dev box, but failed when I installed it on our staging server.

share|improve this answer
    
thanks for feedback. I have no way to try this now. I hope it can be useful for me or someone else the next time! –  superjos Jul 19 '13 at 9:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.