对象未设置为实例...视觉工作室是否在拖我? [英] Object not set to an instance... Is visual studio trolling me?
本文介绍了对象未设置为实例...视觉工作室是否在拖我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了通常的错误,但这是应该发生的行:
Hi,
I get the usual error but this is the line it's supposed to occur on:
public string Serialize()
{
var serializer = new XmlSerializer(GetType()); //<<< This line
TextWriter writer = new StringWriter();
serializer.Serialize(writer, this);
return writer.ToString();
}
我看不出这有什么意义。我的调试器无法展开,但我检查了QuickWatch中的值。该行上的任何内容都不为null,但是我再也看不到该行上的内容可以为null,可以吗?
这不是我第一次已经看过这个,但现在每次都在发生:S
我有什么想法可以继续吗?
谢谢^ _ ^
I don't see how that makes any sense. My debugger is unable to unwind but I have checked the values in QuickWatch. Nothing on that line is null, but then again I can't see what on that line can be null, can it?
This isn't the first time I've seen this but now it's happening every time :S
Any ideas how I can proceed?
Thanks ^_^
推荐答案
听起来像是一些奇怪的行为。你可以在下面的代码中检查这个
的类型吗?在vs中放置一个断点并检查thisType是什么。也许它给出了一个线索。
Sounds like some strange behaviour. Could you check the type ofthis
like in the code below? Put a breakpoint in the vs and check out what thisType is. Maybe it gives a clue.
public string Serialize()
{
Type thisType = this.GetType();
[BREAKPOINT] var serializer = new XmlSerializer(thisType); //<<< This line
TextWriter writer = new StringWriter();
serializer.Serialize(writer, this);
return writer.ToString();
}
祝你好运!
Good luck!
这篇关于对象未设置为实例...视觉工作室是否在拖我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文