Caching the view for an out-of-process audio unit

I'm writing a macOS audio unit hosting app using the AVAudioUnit and AUAudioUnit APIs. I'm trying to use the NSView cacheDisplay(in:to:) function to capture an image of a plugin's view:

func viewToImage(veiwToCapture: NSView) -> NSImage? {
    var image: NSImage? = nil
    if let rep = veiwToCapture.bitmapImageRepForCachingDisplay(in: veiwToCapture.bounds) {
      veiwToCapture.cacheDisplay(in: veiwToCapture.bounds, to: rep)
      image = NSImage(size: veiwToCapture.bounds.size)
      image!.addRepresentation(rep)
    }
    return image
  }
}

This works ok when a plugin is instantiated using the .loadInProcess option. If the plugin is instantiated using the .loadOutOfProcess option the resulting bitmapImageRep is blank.

I'd much rather be loading plugins out-of-process for the enhanced stability. Is there any trick I'm missing to be able to capture the contents of the NSView from an out-of-process audio unit?

Replies

Apple have now told me that this is a technical limitation when running out of process and there are no immediate plans to address this.