【发布时间】:2015-07-25 11:57:27
【问题描述】:
我正在使用 nVLC dll 在我的应用程序中使用 VLC 媒体播放器。除了一件事之外,它就像一种魅力。我有一个带有电影列表的 DataGridView。当我从该 DataGridView 中选择一部电影时,它开始在由 nVLC 处理的面板中播放该电影。我还使用过滤器来过滤 DataGridView 中的电影。当我这样做几次时,我从 nVLC DLL 收到错误:
CallbackOnCollectedDelegate 发生
托管调试助手“CallbackOnCollectedDelegate”在“C:\Users\User\Documents\Visual Studio 2013\Projects\Soft.UltimateMovieManager\Soft.UltimateMovieManager\bin\Release\Soft.UltimateMovieManager.vshost.exe”中检测到问题.
附加信息:对垃圾收集进行了回调 类型代表 'nVLC.Implementation!Implementation.VlcEventHandlerDelegate::Invoke'。 这可能会导致应用程序崩溃、损坏和数据丢失。什么时候 将委托传递给非托管代码,它们必须由 托管应用程序,直到保证它们永远不会 调用。
问题是我无法捕捉到那个例外。即使我在应用程序本身上设置了 try/catch,它仍然无法处理。
这是我自己可以解决的问题,还是我使用的 nVLC dll 的问题?
if (!string.IsNullOrEmpty(video_url))
{
if (pnlStartVideo != null)
{
pnlStartVideo.Dispose();
}
pnlStartVideo = new System.Windows.Forms.Panel();
pnlStartVideo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
pnlStartVideo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
pnlStartVideo.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
pnlStartVideo.Location = new System.Drawing.Point(pnlStartInfo.Location.X, (pnlStartInfo.Location.Y + (pnlStartInfo.Height - 1)));
pnlStartVideo.Name = "pnlStartVideo";
pnlStartVideo.Size = new System.Drawing.Size(275, 153);
pnlStartVideo.TabIndex = 3;
tpStart.Controls.Add(pnlStartVideo);
m_factory = new MediaPlayerFactory(true);
m_player = m_factory.CreatePlayer<IDiskPlayer>();
m_player.WindowHandle = pnlStartVideo.Handle;
m_player.Events.PlayerStopped += Events_PlayerStopped;
UISync ui = new UISync();
ui.Init(this);
m_media = m_factory.CreateMedia<IMedia>(video_url);
m_player.Open(m_media);
m_media.Parse(true);
m_media.Events.StateChanged += Events_StateChanged;
m_player.Play();
}
【问题讨论】:
标签: c# .net dll datagridview vlc