Listener crash in standalone application

1 view (last 30 days)
YM
YM on 19 Jun 2015
Commented: Phillip on 10 Apr 2016
I’m trying to check for file modifications in specific folder by using .Net Events listener in my GUI. But I have some troubles while using standalone version of the code. The idea is to add a listener at GUI startup :
function testGUI_OpeningFcn(hObject, eventdata, handles, varargin)
%Listener
folder = 'D:\Temp';
% .Net
handles.fileObj = System.IO.FileSystemWatcher(folder);
handles.fileObj.Filter = 'log.datc';
handles.fileObj.EnableRaisingEvents = true;
% Filtres
filter = bitor(System.IO.NotifyFilters.FileName, System.IO.NotifyFilters.DirectoryName);
filter = bitor(filter, System.IO.NotifyFilters.Attributes);
filter = bitor(filter, System.IO.NotifyFilters.Size);
filter = bitor(filter, System.IO.NotifyFilters.LastWrite);
filter = bitor(filter, System.IO.NotifyFilters.LastAccess);
filter = bitor(filter, System.IO.NotifyFilters.CreationTime);
filter = bitor(filter, System.IO.NotifyFilters.Security);
handles.fileObj.NotifyFilter = filter;
addlistener(handles.fileObj, 'Created', @eventhandlerChanged);
handles.output = hObject;
Then we need eventhandlerChanged function:
function eventhandlerChanged(obj,eData)
msgbox('Test')
end
So, when the file is modified we can see a massage ‘Test’.
This implementation works perfectly within Matlab interface. Contrariwise, the standalone application (generated by Matlab Builder) crashes every time when modification event is detected. Any ideas why it happens?
Thanks in advance for any help.

Answers (1)

YM
YM on 22 Jun 2015
Edited: YM on 22 Jun 2015
Some precisions about the crash. The crash report says :
------------------------------------------------------------------------
Access violation detected at Mon Jun 22 10:59:09 2015
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: NVIDIA Corporation GeForce GT 640/PCIe/SSE2 Version 4.4.0 NVIDIA 344.11
Default Encoding : windows-1252
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce GT 640 Version 9.18.13.4411
Host Name : SIMU
MATLAB Architecture : win64
MATLAB Root : C:\Program Files\MATLAB\MATLAB Production Server\R2015a
MATLAB Version : 8.5.0.197613 (R2015a)
OpenGL : hardware
Operating System : Microsoft Windows 7 Professionnel
Processor ID : x86 Family 6 Model 45 Stepping 7, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 6.1 (Build 7601: Service Pack 1)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000000000000 RBX = 00000000dee65860
RCX = 0000000000000000 RDX = 00000000e5446d80
RSP = 0000000016262c20 RBP = 00000000103e3e08
RSI = 0000000000000000 RDI = 00000000e5446d80
R8 = 0000000010b77248 R9 = 0000000010a39010
R10 = 000000000ec857c0 R11 = 00000000107329b0
R12 = 0000000000000000 R13 = 000000007463f468
R14 = 00000000103e6e90 R15 = 0000000009492bd0
RIP = 00000000fd0d81de EFL = 00010202
CS = 0033 FS = 0053 GS = 002b
  1 Comment
Phillip
Phillip on 10 Apr 2016
Have you managed to solve this? It's a known bug in compiled .NET callback routines. Very frustrating.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!