- Home /
How can I catch an Unahndled Null exception in a DLL?
Unity3D's log is not very helpful. It just says there is an unhandled null exception. I set up some try catch things around the function calls I thought might be the problem, but nothing is being caught.
Update-- I apologize for any confusion and didn't know what to include in the post.
This DLL is really a .bundle (for OSX, most people come from a windows background and think of everything as a DLL, me included) that is written and maintained by our company for use in assisting our Unity developers. It manages all of the audio for the game.
Generally, the project is run on an iPad where the XCode project has access to the native code without needing a bundle. After a lot of work to remove memory leaks, the iPad project does not exhibit any disruptive behavior. Specifically, when we call a function to stop and delete the class that is operated by the .bundle, the Unity editor crashes with "Receiving unhandled NULL exception, Launching bug reporter" but the iPad does not.
I can see the project in XCode's debugger when running on iPad which is immensely helpful. It would be awesome to attach the XCode debugger to the .bundle as it is operating in Unity. Do you have any similar advice like you did for Visual Studio? I'm wondering how to go about tracking down the bug in this .bundle.
It's a pretty open-ended question though. What is an unhandled null exception.
I'm sorry to say that but, if you don't know what the null exception is, you shouldn't be developing a unity game. Please don't take me wrong. I suggest you to study on program$$anonymous$$g before making games.
You don't know what you're talking about. I know exactly what a null reference exception is.
Hmm. They passed the project to you but they didn't pass the source of the project? That feels bad :( But I know, it happens in professional life.
Answer by AndyMartin458 · Sep 06, 2013 at 06:19 AM
I did the impossible for this. I built a project that made all of these messages send through TCP. Now, I can debug the .bundle in Xcode while I'm running the game in the Unity editor. This is not a possibility when you are running in the Unity editor with a bundle using DLLImport for the functions. It revealed that a callback function was attempting to call a function after the .bundle had been deallocated. Quite the difficult problem.
Answer by RalphTrickey · Aug 07, 2013 at 08:26 PM
I assume you're talking about a C++/Windows DLL. If not, you need to provide more information.
Unity doesn't do anything special here, try this site for some info. You should also be able to attach a c++ debugger to the DLL, start the DLL and use it to launch Unity and run the project. http://www.codeproject.com/Articles/207464/Exception-Handling-in-Visual-Cplusplus
http://msdn.microsoft.com/en-us/library/vstudio/ms164704.aspx
It's actually a $$anonymous$$ac bundle. Any tips like this for XCode?
Sorry, I'm not a $$anonymous$$ac programmer.
You might try this and see if it helps. http://stackoverflow.com/questions/4720098/how-to-debug-dylib-with-xcode
Your answer
![](https://koobas.hobune.stream/wayback/20220613111724im_/https://answers.unity.com/themes/thub/images/avi.jpg)