Photon Debugger的几种方式

photon debugger的几种方式在这里mark一下,防止以后忘记。

第一种方式:

1、打开解决方案,添加现有工程,选择对应的PhotonSocketServer.exe将其添加到解决方案;

2、设置PhotonSocketServer.exe为启动工程;

3、设置PhotonSocketServer工程的项目属性:arguments设置为"/debug Instance1",注意,这里的Instance1代表你的实例名称,具体情况要根据自己的实例名称设置;

4、设置debugger type为Managed。

到此设置完成,可以直接F5调试,这种方式调试时不用启动PhotonControl,也不能启动,否则会提示运行两个实例错误哦。

本人最钟爱这种方式,简单,而且可以调试Setup。


其它我不太钟爱的方式也mark下:


1. Attaching debugger.


Go to Debug -> Attach to Process, select PhotonSocketServer.exe. Also for Attach to: select only Managed code. If you select Native code, then detaching debugger will kill server process. After that hit Attach, and there you go.


2. Launching debugger from your code.


In your Application class (the one that inherits Photon.SocketServer.Application) override Setup() method and add this line: System.Diagnostics.Debugger.Launch(); . When your server code will be launched you get a nice message box that will ask you if you want to attach the debugger. You can debug startup code this way!


3. Attaching debugger automatically.


This one is my favorite, as it attaches the debugger by simply clicking F5 in Visual Studio. For this create a dummy empty C++ project in your solution. Add main.cpp and a stub for main(). Select it as startup project. Setup project dependencies that building this one will build your server too. Go to project properties and in Debugging tab change Command to where PhotonSocketServer.exe is located, for example: "e:\Projects\Photon\Server\deploy\bin_Win32\PhotonSocketServer.exe". For Attach choose Yes. Set Debugger Type to Managed Only (mixing with native kills the server after detaching debugger). And voila! Hit F5 and it will compile, update your server, and attach a debugger in just a couple seconds. :-) And you can debug startup code this way too!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值