File tree Expand file tree Collapse file tree 5 files changed +12
-9
lines changed
CefSharp.BrowserSubprocess.Core
CefSharp.Core.RefAssembly
CefSharp.Core/BrowserSubprocess
CefSharp.WinForms.Example Expand file tree Collapse file tree 5 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ namespace CefSharp
41
41
// / with a value of -1. If called for a recognized secondary process it will block until the process should exit
42
42
// / and then return the process exit code.
43
43
// / </returns
44
- static int MainNetCoreSelfHost (array<String^>^ args)
44
+ static int MainSelfHost (array<String^>^ args)
45
45
{
46
46
auto subProcess = gcnew BrowserSubprocessExecutable ();
47
47
return subProcess->Main (args, nullptr );
Original file line number Diff line number Diff line change @@ -334,7 +334,7 @@ namespace CefSharp.BrowserSubprocess
334
334
public partial class SelfHost
335
335
{
336
336
public SelfHost ( ) { }
337
- public static int MainNetCore ( string [ ] args ) { throw null ; }
337
+ public static int Main ( string [ ] args ) { throw null ; }
338
338
}
339
339
}
340
340
namespace CefSharp . Internals
Original file line number Diff line number Diff line change 7
7
8
8
using namespace System ;
9
9
using namespace System ::IO;
10
- using namespace System ::Runtime::Loader;
11
10
using namespace CefSharp ;
12
11
13
12
namespace CefSharp
14
13
{
15
14
namespace BrowserSubprocess
16
15
{
17
- int SelfHost::MainNetCore (array<String^>^ args)
16
+ int SelfHost::Main (array<String^>^ args)
18
17
{
19
18
auto type = CommandLineArgsParser::GetArgumentValue (args, CefSharpArguments::SubProcessTypeArgument);
20
19
@@ -27,11 +26,15 @@ namespace CefSharp
27
26
}
28
27
29
28
auto browserSubprocessDllPath = Path::Combine (Path::GetDirectoryName (SelfHost::typeid ->Assembly ->Location ), " CefSharp.BrowserSubprocess.Core.dll" );
30
- auto browserSubprocessDll = AssemblyLoadContext::Default->LoadFromAssemblyPath (browserSubprocessDllPath);
29
+ #ifdef NETCOREAPP
30
+ auto browserSubprocessDll = System::Runtime::Loader::AssemblyLoadContext::Default->LoadFromAssemblyPath (browserSubprocessDllPath);
31
+ #else
32
+ auto browserSubprocessDll = System::Reflection::Assembly::LoadFrom (browserSubprocessDllPath);
33
+ #endif
31
34
auto browserSubprocessExecutableType = browserSubprocessDll->GetType (" CefSharp.BrowserSubprocess.BrowserSubprocessExecutable" );
32
35
auto browserSubprocessExecutable = Activator::CreateInstance (browserSubprocessExecutableType);
33
36
34
- auto mainMethod = browserSubprocessExecutableType->GetMethod (" MainNetCoreSelfHost " , System::Reflection::BindingFlags::Static | System::Reflection::BindingFlags::Public);
37
+ auto mainMethod = browserSubprocessExecutableType->GetMethod (" MainSelfHost " , System::Reflection::BindingFlags::Static | System::Reflection::BindingFlags::Public);
35
38
auto argCount = mainMethod->GetParameters ();
36
39
37
40
auto methodArgs = gcnew array<Object^>(1 );
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ namespace CefSharp
32
32
// / with a value of -1. If called for a recognized secondary process it will block until the process should exit
33
33
// / and then return the process exit code.
34
34
// / </returns
35
- static int MainNetCore (array<String^>^ args);
35
+ static int Main (array<String^>^ args);
36
36
37
37
};
38
38
}
Original file line number Diff line number Diff line change @@ -17,15 +17,15 @@ public class Program
17
17
[ STAThread ]
18
18
public static int Main ( string [ ] args )
19
19
{
20
- const bool selfHostSubProcess = true ;
20
+ const bool selfHostSubProcess = false ;
21
21
22
22
Cef . EnableHighDPISupport ( ) ;
23
23
24
24
//NOTE: Using a simple sub processes uses your existing application executable to spawn instances of the sub process.
25
25
//Features like JSB, EvaluateScriptAsync, custom schemes require the CefSharp.BrowserSubprocess to function
26
26
if ( selfHostSubProcess )
27
27
{
28
- var exitCode = CefSharp . BrowserSubprocess . SelfHost . MainNetCore ( args ) ;
28
+ var exitCode = CefSharp . BrowserSubprocess . SelfHost . Main ( args ) ;
29
29
30
30
if ( exitCode >= 0 )
31
31
{
You can’t perform that action at this time.
0 commit comments