NET assembly unload conundrum
16 次查看(过去 30 天)
显示 更早的评论
I am trying to develop a C# class in Visual Studio and test it in Matlab. I can load the NET assembly and use it okay, but a problem arises if I change the NET code.
If I load the NET assembly into Matlab from the Visual Studio debug folder I can't rebuild the assembly in Visual Studio.
If I copy the dll into a local folder and load into Matlab from there I can only load once. Subsequent times I get the following error: "The process cannot access the file because it is being used by another process." In other words it won't let me copy the new dll because the old one is still in use.
So at the moment if I change the assembly code I have to close Matlab and reopen it to test the new assembly. This is adding quite a lot of time to my development.
I believe my version of Matlab (2010a) cannot unload NET assemblies. Does anyone know of another way around this?
0 个评论
采纳的回答
Fab
2013-7-19
According to Matlab's support rebooting is the only solution to this problem for the current Matlab Version (8.1.0.604, R2013a):
"The ability to unload an assembly is not available in MATLAB at this point of time. This may be addressed in one of the future releases. Currently, to work around this issue, restart MATLAB."
Somehow shocking, isn't it? (see also http://www.mathworks.com/matlabcentral/newsreader/view_thread/330604)
0 个评论
更多回答(5 个)
imme werus
2017-4-24
编辑:imme werus
2017-4-24
I think it is also the same for 2016b, is that true ?
0 个评论
Markus Finkeldey
2017-10-10
编辑:Markus Finkeldey
2017-10-10
It seems that the .NET support of Matlab is very limited even in R2017a, makes it a hell of a workload if you want to access a c# library instead of a pure c library.
Travis Leith
2019-10-30
This is still an issue going into 2020 :(
3 个评论
Roofus Milton
2019-11-15
Yup. Wolfram has great integration. I suspect their approach creates a new AppDomain and subsequently loads the requested assemblies. LINQPad has remained my default testing tool.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!