Instructions on how to run a debug build of MediaPortal 2.
Make sure you read the guide about Compiling MediaPortal 2. It covers everything to run MediaPortal 2 in release configuration and all prerequisites listed there also apply for this guide.
Setting up the working copy(s)
When developing and debugging MediaPortal 2, you'll typically need at least one copy of the code on your local harddisc. A copy of the code is typically a local GIT repository. If you debug both client and server, you should have at least two copies. In general, you need at least one copy per opened Visual Studio instance. In my own root MediaPortal development directory, I have the directories MP-Client, MP-Server and MP-Work1, MP-Work2 and so on. Each of them is its own local GIT repository. See the Git section how to check out.
You can rename the root folder of the GIT repository (the folder where the .git directory is located) as you wish. If you have checked out the GIT repository multiple times, each of those copies is independent from the other ones, so they behave as if you would have checked out each of them on a different computer.
Setting up Visual Studio 2010
Set the Startup Project
Open one of the solution files from the Source folder in Visual Studio 2010, right click on the included C# project Main/MediaPortal.Client or Main/MediaPortal.Server and chose "Set as StartUp Project". Now set the solution configuration to "Debug" and run the solution with the green "Play" symbol or hit F5 on your keyboard.
The debugging process
Common problems during debugging
There are several known problems during debugging:
- Don't open multiple instances of VisualStudio in the same working copy. So if you want to run both the MP2 client and server in VS, you have to do that in two different working copies (see above). If you would use the same working copy, the instance which builds the system the second time can get tangled up and maybe leave out the compile of some projects, which leads to an incomplete output directory. When MP2 starts, you'll probably encounter a PluginMissingDependencyException .
- When stepping over the statements in the integrated VS debugger, sometimes the debugger becomes very slow. When that happens, it doesn't take long until a step over doesn't work any more at all; instead, the debugger just runs the code as if you had choosen the run command, sometimes the application doesn't behave any more as expected. When that happens, it doesn't make sense to continue the debug session. That problem is known but I don't know a solution to avoid it.
- If VS hangs when you set a break point during the runtime of MP2, try to delete the .suo file.
Deleting configuration directories or server database
During development, sometimes it is necessary to delete the configuration directories or the server's database file. That may be because the format of the configuration files changed or because the database schema was changed. If that happens, go to the directory C:\ProgramData\Team MediaPortal\MP2-Client or C:\ProgramData\Team MediaPortal\MP2-Server and delete the Config directory or the datastore file or directory (depending on the database implementation you use; for example SQL Server CE uses a single file).
You should know that when deleting the client's configuration, the client will "forget" its identity. The client will then create a new identity and behave as completely different client. It will break the connection to the MP2 server and will leave data in the server's database (like imported media items etc.). Later, we plan to have a command to detach an old client from the server, but currently, you must delete the server's database to remove data of such an orphaned client.
Vice versa, if you delete the server's database without deleting the client's configuration files, the client will automatically re-attach to the server. In that case, only the server's shares are lost and must be reconfigured.
Results in this
Deleting the client's configuration directory
The client's configuration will be lost. The client will lose its identity, and generate a new one. All its shares will become orphaned at the server.
Changing the client' shares configuration manually in the config file
The client will automatically synchronize its shares settings with the server when the connection is established the next time.
Deleting the server's configuration directory (including both the config files and the database)
The server "forgets" its old identity and will create a new one; the client needs to be detached from the old home server and attached to the new server.
Deleting the server's configuration files, but leave the database as it is.
Only the server's configuration entries will be lost. The MediaLibrary and the server's identity will be retained.
Deleting the server's database, but leave the config files.
The server will forget its identity and will create a new one. The MediaLibrary contents will be lost. All clients need to re-attach to the server. The server's shares will be lost.
Debugging/checking the server's SQL database contents
When using the SQLCEDatabase plugin, you can connect to the database file via the Microsoft SQL Server Management Studio. That can be done while the MP2 server is running.
This page has no comments.