obiwanjacobi / vst.net

Virtual Studio Technology (VST) for .NET. Plugins and Host applications.
https://obiwanjacobi.github.io/vst.net/index.html
GNU Lesser General Public License v2.1
420 stars 52 forks source link

Jacobi.Vst.Samples.Host loading reacomp-standalone.dll results in NullReferenceException at HostCommandStub.HostCommands.GetCurrentPluginID() Line 203 #62

Open paulpv opened 2 years ago

paulpv commented 2 years ago

Describe the bug I tried loading https://www.reaper.fm/reaplugs/ reacomp-standalone.dll and got the following crash:

System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Jacobi.Vst.Samples.Host StackTrace: at Jacobi.Vst.Samples.Host.HostCommandStub.HostCommands.GetCurrentPluginID() in C:\Dev\GitHub\NightVsKnight\vst.net\Source\Samples\Jacobi.Vst.Samples.Host\HostCommandStub.cs:line 203

image

PluginInfo is indeed null.

Note that all of the other reaplug plugins do load. There is just something odd about the reacomp-standalone.dll image

To Reproduce Steps to reproduce the behavior:

  1. Install reaplugs https://www.reaper.fm/reaplugs/
  2. Launch Jacobi.Vst.Samples.Host and load C:\Program Files\VSTPlugins\ReaPlugs\reacomp-standalone.dll

Expected behavior Plugin loads

Desktop:

I've tried stepping through the code to see where the malfunction is, but so far have not found it...

paulpv commented 2 years ago

When loading reacomp-standalone.dll, the very first command in ::Vst2IntPtr VstHostCommandProxy::Dispatch(int32_t opcode, int32_t index, ::Vst2IntPtr value, void* ptr, float opt) is command = CurrentId (2).

image

Incidentally, loading all of the other reaplugs never triggers that command = CurrentId (2). They all only ever show opcode= 0xdeadbeef and index = 0xdeadf00d.

paulpv commented 2 years ago

I changed HostCommandStub.HostCommands.GetCurrentPluginID() to the following "safer" code and now it does not crash. image

I am not sure if -1 is an appropriate return value.

paulpv commented 2 years ago

See https://github.com/NightVsKnight/vst.net/commit/2996d03e379c11c5d5a5d5de8620acaa256eea5f.

Again, not sure what an appropriate "unknown plugin id" value is.