I use RemotingServices.Marshal and Activator.GetObject to establish a remote channel between two simple programs located on the same computer.
public class IpcInterface : MarshalByRefObject { public int number = -1; public string text = "default"; public List<String> strings; }
I confirmed that the channel exists, and communication is possible because both programs successfully change number and text to completely unique values (confirmed).
So I immediately tried to do the same for strings .
In one program, I called strings.Add("1") . I tried reading the contents of strings in a second program. He was empty. What else, the score was 0 . I have no idea why strings continues to have 0 objects, as if I never added them. The same thing happens for Stack<T> and Dictionary<T, K> , I just can’t add any elements to it. To be sure that in the general case there wasn’t anything strange with reference types, I also tried putting StringBuilder in the IPC interface class and that the “state” is successfully maintained in both programs by changing its value.
Question: Why is the list of strings not added and what is the solution?
I hope that someone with experience will immediately find this problem. I tried Googling for similar questions, but I did not get any useful results. Surprisingly, I only have 1 good link for googling "debugging .net removes the transparent proxy". This is the second question I have. How can I debug a transparent proxy object?
- All objects are created correctly (there is no NullReferenceException, in fact there are no exceptions).
source share