调用 Isolate::New() 后访问冲突执行位置 0x0000000000000000
Access violation executing location 0x0000000000000000 after calling Isolate::New()
我似乎无法弄清楚启动 V8 的方法。我有这个代码:
if (!_V8Initialized)
{
v8::V8::InitializeICU();
v8::V8::InitializeExternalStartupData("x86\"); // (this loads ok, I checked)
auto platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
_V8Initialized = true;
}
auto params = Isolate::CreateParams();
params.array_buffer_allocator = ArrayBuffer::Allocator::NewDefaultAllocator();
_Isolate = Isolate::New(params);
但是我得到这个错误:
Exception thrown at 0x0000000000000000 in V8.Net.Console.exe:
0xC0000005: Access violation executing location 0x0000000000000000.
v8_libbase.dll!v8::base::OS::Abort() Line 832 C++
v8_libbase.dll!V8_Fatal(const char * file, int line, const char * format, ...) Line 74 C++
v8.dll!v8::internal::SnapshotData::SnapshotData(const v8::internal::Vector snapshot) Line 28 C++
v8.dll!v8::internal::Snapshot::Initialize(v8::internal::Isolate * isolate) Line 43 C++
v8.dll!v8::Isolate::New(const v8::Isolate::CreateParams & params) Line 8237 C++
V8_Net_Proxy_x64.dll!V8EngineProxy::V8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 89 C++
V8_Net_Proxy_x64.dll!CreateV8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 19 C++
[Managed to Native Transition]
V8.Net.dll!V8.Net.V8Engine.V8Engine() Line 246 C#
V8.Net.Console.exe!V8.Net.Program.Main(string[] args) Line 31 C#
[Native to Managed Transition]
mscoreei.dll!00007ffdbdd281ad() Unknown
mscoree.dll!00007ffdbddc10ab() Unknown
kernel32.dll!00007ffdd3868364() Unknown
ntdll.dll!00007ffdd5ef70d1() Unknown
这里好像失败了:
explicit SnapshotData(const Vector<const byte> snapshot)
: SerializedData(const_cast<byte*>(snapshot.begin()), snapshot.length()) {
CHECK(IsSane()); <-- THIS FAILS
}
我在这里遵循了源代码(大部分):https://chromium.googlesource.com/v8/v8/+/branch-heads/4.8/samples/hello-world.cc
...但我不确定为什么我会收到空错误。我一定是遗漏了什么...
没关系,我似乎总是在发布到 SO 后才能解决问题,大声笑。事实证明我是从 x86 目录而不是 x64 目录加载的(我应该猜到 V8_Net_Proxy_x64.dll!大声笑)。
我本来打算删除这个问题的,但我还是把它留在这里,以防其他人在半夜半睡半醒的时候陷入这个问题。 ;)
我似乎无法弄清楚启动 V8 的方法。我有这个代码:
if (!_V8Initialized)
{
v8::V8::InitializeICU();
v8::V8::InitializeExternalStartupData("x86\"); // (this loads ok, I checked)
auto platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
_V8Initialized = true;
}
auto params = Isolate::CreateParams();
params.array_buffer_allocator = ArrayBuffer::Allocator::NewDefaultAllocator();
_Isolate = Isolate::New(params);
但是我得到这个错误:
Exception thrown at 0x0000000000000000 in V8.Net.Console.exe: 0xC0000005: Access violation executing location 0x0000000000000000.
v8_libbase.dll!v8::base::OS::Abort() Line 832 C++ v8_libbase.dll!V8_Fatal(const char * file, int line, const char * format, ...) Line 74 C++ v8.dll!v8::internal::SnapshotData::SnapshotData(const v8::internal::Vector snapshot) Line 28 C++ v8.dll!v8::internal::Snapshot::Initialize(v8::internal::Isolate * isolate) Line 43 C++ v8.dll!v8::Isolate::New(const v8::Isolate::CreateParams & params) Line 8237 C++ V8_Net_Proxy_x64.dll!V8EngineProxy::V8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 89 C++ V8_Net_Proxy_x64.dll!CreateV8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 19 C++ [Managed to Native Transition]
V8.Net.dll!V8.Net.V8Engine.V8Engine() Line 246 C# V8.Net.Console.exe!V8.Net.Program.Main(string[] args) Line 31 C# [Native to Managed Transition]
mscoreei.dll!00007ffdbdd281ad() Unknown mscoree.dll!00007ffdbddc10ab() Unknown kernel32.dll!00007ffdd3868364() Unknown ntdll.dll!00007ffdd5ef70d1() Unknown
这里好像失败了:
explicit SnapshotData(const Vector<const byte> snapshot)
: SerializedData(const_cast<byte*>(snapshot.begin()), snapshot.length()) {
CHECK(IsSane()); <-- THIS FAILS
}
我在这里遵循了源代码(大部分):https://chromium.googlesource.com/v8/v8/+/branch-heads/4.8/samples/hello-world.cc
...但我不确定为什么我会收到空错误。我一定是遗漏了什么...
没关系,我似乎总是在发布到 SO 后才能解决问题,大声笑。事实证明我是从 x86 目录而不是 x64 目录加载的(我应该猜到 V8_Net_Proxy_x64.dll!大声笑)。
我本来打算删除这个问题的,但我还是把它留在这里,以防其他人在半夜半睡半醒的时候陷入这个问题。 ;)