小编Tim*_*ass的帖子

"无法连接到远程VM"将jdb连接到Windows上的Android模拟器

我一直试图将jdb连接到android模拟器一段时间,并且已经反复遇到:

jdb -sourcepath ./src -attach localhost:8700

java.io.IOException: shmemBase_attach failed: The system cannot find the file specified
        at com.sun.tools.jdi.SharedMemoryTransportService.attach0(Native Method)
        at com.sun.tools.jdi.SharedMemoryTransportService.attach(SharedMemoryTransportService.java:90)
        at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:98)
        at com.sun.tools.jdi.SharedMemoryAttachingConnector.attach(SharedMemoryAttachingConnector.java:45)
        at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:358)
        at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:168)
        at com.sun.tools.example.debug.tty.Env.init(Env.java:64)
        at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1010)

Fatal error:
Unable to attach to target VM.

不太好.绕过这个最好的方法是什么?我在Windows 7 64bit上运行.

java windows debugging jdb android-emulator

11
推荐指数
1
解决办法
1万
查看次数

在C#中将Timespan转换为DateTime

我正在使用C#和Microsoft.Office.Interop阅读Excel工作表数据.工作表包含一些日期值.当我试图读取该值时,它只是给出了数字(可能是TimeSpan).我在将此数字转换为DateTime时遇到问题.

以下是代码:

TimeSpan ts = TimeSpan.Parse(((Range)ws.Cells[4, 1]).Value2.ToString());
Run Code Online (Sandbox Code Playgroud)

哪里wsExcel.WorkSheet.

任何人都可以解释我应该如何将这个数字(TimeSpan)转换成DateTime

感谢您分享宝贵的时间.

c# datetime ole-automation excel-interop

10
推荐指数
3
解决办法
4万
查看次数

公共语言运行库什么时候终止?

在MSDN上的字符串实习的性能部分中有一个有用的警告:

在公共语言运行时(CLR)终止之前,不太可能释放为被占用的String对象分配的内存.

但是:CLR什么时候终止?

.net c# clr

10
推荐指数
1
解决办法
470
查看次数

如何从 Rider 调试 WSL2 中的进程?

我想调试在 WSL2 下运行的 .NET Core 进程,但无法从 Windows 中的 Rider 附加到它。有办法实现这一点吗?

c# debugging rider wsl-2

9
推荐指数
1
解决办法
4483
查看次数

在桌面上安装窗口的算法(如瓷砖)

我搜索算法来解决这样的问题:

我有几个窗户,每个窗户都可以移动和重新调整尺寸,但宽度和高度之间的比例,例如.2:1(高度:宽度).

每个窗口都不能在其他窗口上,所有窗口必须完全可见.自由区域(桌面壁纸可见性)必须最小化.

谁能告诉我这类问题需要什么算法?

问候,

algorithm tiling packing

8
推荐指数
1
解决办法
2143
查看次数

计数方法调用Rhino Mocks

所以:我想在Rhino Mocks中使用比Any(),Once()或AtLeastOnce()更具体的方法来计算方法调用.这样做有什么机制吗?

c# rhino-mocks

8
推荐指数
1
解决办法
4801
查看次数

调试UnhandledException事件时,为什么Visual Studio会循环

(这看起来非常类似于来自另一个线程的C#UnhandledException保持循环,但我不是试图在这里捕获异常,只是有机会记录一些东西)

我有一些非常简单的C#代码,用于设置UnhandledException事件处理程序,然后抛出异常:

class Program
{
    static void Main(string[] args)
    {
        AppDomain currentDomain = AppDomain.CurrentDomain;
        //currentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException);

        currentDomain.UnhandledException += (sender, eventArgs) =>
            {
                var exception = (Exception) eventArgs.ExceptionObject;

                Console.WriteLine("Unhandled exception: " + exception.Message);
            };

        throw new AccessViolationException("Bleurgh");
    }
}
Run Code Online (Sandbox Code Playgroud)

它的行为与我期望从控制台一样:

Unhandled exception: Bleurgh
Unhandled Exception: System.AccessViolationException: Bleurgh
    at UnhandledExceptions.Program.Main(String[] args) in c:\code\sandbox\UnhandledExceptions\UnhandledExceptions\Program.cs:line 20
Run Code Online (Sandbox Code Playgroud)

但是当我尝试在Visual Studio中调试它时,它进入一个循环,进入事件处理程序,然后退出以重新抛出异常.

当我将处理程序表示为一个独特的静态方法时,会发生同样的事情.

有什么想法发生了什么?

这是在Visual Studio 2010中.编辑:和.NET 4.

c# visual-studio-2010 unhandled-exception c#-4.0

8
推荐指数
1
解决办法
1254
查看次数

模拟静态类

我有一个静态类,它包含winspool中的一些本机方法:

public static class WinSpool
{
     [DllImport("winspool.drv")]
     public static extern int OpenPrinter(string pPrinterName, out IntPtr phPrinter, IntPtr pDefault);
     ...
     //some more methods here
}
Run Code Online (Sandbox Code Playgroud)

我想模仿它们进行单元测试,但是找不到这种模式.(每个人都避免使用静态类吗?)

.net mocking static-classes

7
推荐指数
1
解决办法
5741
查看次数

Visual Studio断点 - 中断特定文件访问

在读取或写入特定文件时,有没有办法让VS调试会话中断?

在这种情况下,我想将它用作一个探索性工具 - 假设我不知道在这个文件被访问的大型代码库中的位置,或者文件名被设置的位置 - 它可能会从深处拾取在一些大规模的配置.

.net debugging breakpoints visual-studio

7
推荐指数
1
解决办法
1828
查看次数

确定ZwWaitForMultipleObjects正在等待的对象

看看windbg中的崩溃转储,我可以看到所有当前线程都停滞不前

> ~2k
ChildEBP RetAddr  
00d2fcc8 7d4e27dc ntdll_7d600000!ZwWaitForMultipleObjects+0x15
Run Code Online (Sandbox Code Playgroud)

或单个对象的变体.

由于等待对象的句柄传递给ZwWaitForMultipleObjects,我假设我可以找出它使用的变体

!do <address>
Run Code Online (Sandbox Code Playgroud)

有正确的地址 - 但我不知道如何构建正确的地址.我假设我需要从ChildEBP获得一些补偿?

windbg

6
推荐指数
1
解决办法
4231
查看次数