| Printed |
Page 18
1st paragraph, first line. |
"When the compiler generates an EXE file. its entry point is the WinMain() method."
I've search Google, all said the entry point is CorExeMain.
I also dump the PE information of a .exe file, there's no
WinMain() but only a _CoreExeMain imported from MSCorEE.dll.
|
Anonymous |
| Printed |
Page 239
The note |
Note: I have not finished reading the entire book yet, but I must say, this is one of
the best, if not The Best, books that I've read on the subject.
The note states: ".., the calling assembly must reference the assembly being
specified"
I believe this is not absolutely true if interfaces are used.
Here is an example (which I wrote some time ago to prove some other point) that
involves 4 assemblies:
1) "Interfaces" assembly declares Interface1 and interface2
2) "ClassLibrary1" assembly contains TestClass1 that implements Interface1
3) "ClassLibrary2" assembly contains TestClass2 and TestClass3, both implement
Interface2
4) "DomainTest" contains a Form which loads ClassLibrary1 in one domain, and
ClassLibrary2 in another domain, but it only references the Interfaces assembly.
Following are excerpts from the Interfaces and DomainTest assemblies:
"Interfaces" contains the following
public interface Interface1
{
void Test();
}
public interface Interface2:Interface1
{
void OtherClasses(Interface1 cls2, Interface1 cls3);
}
DomainTest contains the following code:
AppDomain appDomain1 = null;
AppDomain appDomain2 = null;
Interface1 testClass1 = null;
Interface2 testClass2 = null;
Interface2 testClass3 = null;
private void LoadDomain2()
{
try
{
AppDomainSetup setup2 = new AppDomainSetup();
setup2.ApplicationName = "TestClass2";
appDomain2 = AppDomain.CreateDomain("Domain2", null, setup2);
testClass2 = (Interface2)
appDomain2.CreateInstanceFromAndUnwrap("ClassLibrary2.dll",
"ClassLibrary2.TestClass2");
testClass3 = (Interface2)
appDomain2.CreateInstanceFromAndUnwrap("ClassLibrary2.dll",
"ClassLibrary2.TestClass3");
if(testClass1 != null)
{
testClass1.OtherClasses(testClass2,testClass3);
}
}
catch(Exception ex1)
{
MessageBox.Show("LoadDomain2: " + ex1.ToString());
}
}
private void LoadDomain1()
{
try
{
AppDomainSetup setup1 = new AppDomainSetup();
setup1.ApplicationName = "TestClass1";
appDomain1 = AppDomain.CreateDomain("Domain1", null, setup1);
testClass1 = (Interface1)
appDomain1.CreateInstanceFromAndUnwrap("ClassLibrary1.dll",
"ClassLibrary1.TestClass1");
testClass1.OtherClasses(testClass2,testClass3);
}
catch(Exception ex1)
{
MessageBox.Show("LoadDomain1: " + ex1.ToString());
}
}
private void btnTest_Click(object sender, System.EventArgs e)
{
if (testClass1 != null)
{
testClass1.Test(); //verifies that class1 has access to both class2 and class3
}
}
|
Anonymous |
| Printed |
Page 285
First code sample |
I believe this code:
IChannel channel = new TcpChannel();
should pass port 0 into the TcpChannel constructor:
IChannel channel = new TcpChannel(0);
The MSDN documentation states that if the default constructor is used, "the channel
functions only as a client channel, and does not listen on any ports", so it seems
that Remote Callbacks would not work.
|
Anonymous |