我正在使用 DotRas 版本 1.3.5166(codeplex 的最新版本),似乎我发现了一个严重的错误 =((
我正在尝试在 rasphone.pbk 中添加一个新条目
foreach (Tuple<string, string> serv in servers)
{
// Item1 = connectionName
// Item2 = IP
createEntryInPhonebook(serv.Item1, serv.Item2); // BreakPoint1 in this function
} //BreakPoit 2
和
public void createEntryInPhonebook(string connectionName, string serverAddress)
{
if (this.phonebook.Entries.Contains(connectionName))
return ;
RasDevice device = RasDevice.GetDevices().Where(o => o.DeviceType == RasDeviceType.Vpn).First();
RasEntry entry = RasEntry.CreateVpnEntry(connectionName, serverAddress, RasVpnStrategy.Default, RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn), false);
this.phonebook.Entries.Add(entry);
} //// BreakPoint 1
在 Break Point1 的第一步,我有
this.phonebook.Entries.Count = 1
但是,在我的 foreach 循环的第一步中,我在 BreakPoint 2
this.phonebook.Entries.Count = 2; // !!!!!!
实体是相似的!它们具有相同的连接名称、IP 地址,即使this.phonebook.Entries[0].Id == this.phonebook.Entries[1].Id
在此之后,如果我尝试添加或删除任何项目,程序也会崩溃/我在 codeplex 提供的示例中发现了相同的问题 =( ( https://dotras.codeplex.com/发布/查看/67408)