AppDomain.CreateDomain pb!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

I have a serializationEception. Impossible to deserialize the object.
I have try with app.AssemblyResolve but i have not found the solution.

My purpose is to launch my program directly from the memory.

// Bhe bytes in the assembly.
byte[] byteload = null;

// Open the file stream and read the bytes.
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\Berdoues\Mes documents\Visual Studio
Projects\Application_Test_WindowsForm\LoadAssembly\CaptureControl.exe",FileMode.Open))
{
// Create the byte array with the length.
byteload = new byte[fs.Length];

// Read the bytes.
fs.Read(byteload, 0, byteload.Length);
}

AppDomain app = AppDomain.CreateDomain("juju");
app.Load(byteload).EntryPoint.Invoke(null,null);
//app.AssemblyResolve +=new ResolveEventHandler(app_AssemblyResolve);

Thank you!

Wavemill
 
Hello!

The exception is on
app.Load(byteload).EntryPoint.Invoke(null,null);

Thank you

Wavemill

Nicholas Paldino said:
Wavemill,

At what point are you getting the exception?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

wavemill said:
Hello!

I have a serializationEception. Impossible to deserialize the object.
I have try with app.AssemblyResolve but i have not found the solution.

My purpose is to launch my program directly from the memory.

// Bhe bytes in the assembly.
byte[] byteload = null;

// Open the file stream and read the bytes.
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\Berdoues\Mes documents\Visual Studio
Projects\Application_Test_WindowsForm\LoadAssembly\CaptureControl.exe",FileMode.Open))
{
// Create the byte array with the length.
byteload = new byte[fs.Length];

// Read the bytes.
fs.Read(byteload, 0, byteload.Length);
}

AppDomain app = AppDomain.CreateDomain("juju");
app.Load(byteload).EntryPoint.Invoke(null,null);
//app.AssemblyResolve +=new ResolveEventHandler(app_AssemblyResolve);

Thank you!

Wavemill
 
Well, there are three separate calls there, which one is it?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

wavemill said:
Hello!

The exception is on
app.Load(byteload).EntryPoint.Invoke(null,null);

Thank you

Wavemill

Nicholas Paldino said:
Wavemill,

At what point are you getting the exception?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

wavemill said:
Hello!

I have a serializationEception. Impossible to deserialize the object.
I have try with app.AssemblyResolve but i have not found the solution.

My purpose is to launch my program directly from the memory.

// Bhe bytes in the assembly.
byte[] byteload = null;

// Open the file stream and read the bytes.
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\Berdoues\Mes documents\Visual Studio
Projects\Application_Test_WindowsForm\LoadAssembly\CaptureControl.exe",FileMode.Open))
{
// Create the byte array with the length.
byteload = new byte[fs.Length];

// Read the bytes.
fs.Read(byteload, 0, byteload.Length);
}

AppDomain app = AppDomain.CreateDomain("juju");
app.Load(byteload).EntryPoint.Invoke(null,null);
//app.AssemblyResolve +=new ResolveEventHandler(app_AssemblyResolve);

Thank you!

Wavemill
 
Hello!

I dont understand the question

wavemill

Nicholas Paldino said:
Well, there are three separate calls there, which one is it?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

wavemill said:
Hello!

The exception is on
app.Load(byteload).EntryPoint.Invoke(null,null);

Thank you

Wavemill

Nicholas Paldino said:
Wavemill,

At what point are you getting the exception?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello!

I have a serializationEception. Impossible to deserialize the object.
I have try with app.AssemblyResolve but i have not found the solution.

My purpose is to launch my program directly from the memory.

// Bhe bytes in the assembly.
byte[] byteload = null;

// Open the file stream and read the bytes.
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\Berdoues\Mes documents\Visual Studio
Projects\Application_Test_WindowsForm\LoadAssembly\CaptureControl.exe",FileMode.Open))
{
// Create the byte array with the length.
byteload = new byte[fs.Length];

// Read the bytes.
fs.Read(byteload, 0, byteload.Length);
}

AppDomain app = AppDomain.CreateDomain("juju");
app.Load(byteload).EntryPoint.Invoke(null,null);
//app.AssemblyResolve +=new ResolveEventHandler(app_AssemblyResolve);

Thank you!

Wavemill
 
Wavemill,

When you make a call like this:

app.Load(byteload).EntryPoint.Invoke(null,null);

It is actually the same as this:

Assembly asm = app.Load(byteload);
MethodInfo m = asm.EntryPoint;
m.Invoke(null, null);

Those are three separate calls that can throw the exception. Which one
is it?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


wavemill said:
Hello!

I dont understand the question

wavemill

Nicholas Paldino said:
Well, there are three separate calls there, which one is it?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

wavemill said:
Hello!

The exception is on
app.Load(byteload).EntryPoint.Invoke(null,null);

Thank you

Wavemill

:

Wavemill,

At what point are you getting the exception?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello!

I have a serializationEception. Impossible to deserialize the
object.
I have try with app.AssemblyResolve but i have not found the
solution.

My purpose is to launch my program directly from the memory.

// Bhe bytes in the assembly.
byte[] byteload = null;

// Open the file stream and read the bytes.
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\Berdoues\Mes documents\Visual Studio
Projects\Application_Test_WindowsForm\LoadAssembly\CaptureControl.exe",FileMode.Open))
{
// Create the byte array with the length.
byteload = new byte[fs.Length];

// Read the bytes.
fs.Read(byteload, 0, byteload.Length);
}

AppDomain app = AppDomain.CreateDomain("juju");
app.Load(byteload).EntryPoint.Invoke(null,null);
//app.AssemblyResolve +=new
ResolveEventHandler(app_AssemblyResolve);

Thank you!

Wavemill
 
The error is :
Assembly asm = app.Load(byteload);

thank you and sorry for my bad english!

Wavemill

wavemill said:
Hello!

I dont understand the question

wavemill

Nicholas Paldino said:
Well, there are three separate calls there, which one is it?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

wavemill said:
Hello!

The exception is on
app.Load(byteload).EntryPoint.Invoke(null,null);

Thank you

Wavemill

:

Wavemill,

At what point are you getting the exception?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello!

I have a serializationEception. Impossible to deserialize the object.
I have try with app.AssemblyResolve but i have not found the solution.

My purpose is to launch my program directly from the memory.

// Bhe bytes in the assembly.
byte[] byteload = null;

// Open the file stream and read the bytes.
using (FileStream fs = new FileStream(@"C:\Documents and
Settings\Berdoues\Mes documents\Visual Studio
Projects\Application_Test_WindowsForm\LoadAssembly\CaptureControl.exe",FileMode.Open))
{
// Create the byte array with the length.
byteload = new byte[fs.Length];

// Read the bytes.
fs.Read(byteload, 0, byteload.Length);
}

AppDomain app = AppDomain.CreateDomain("juju");
app.Load(byteload).EntryPoint.Invoke(null,null);
//app.AssemblyResolve +=new ResolveEventHandler(app_AssemblyResolve);

Thank you!

Wavemill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top