SConnect.exe中出现“System.IO.FileNotFoundException”类型的异常,但未在用户代码中处理 [英] An exception of type 'System.IO.FileNotFoundException' occurred in SConnect.exe but was not handled in user code

查看:165
本文介绍了SConnect.exe中出现“System.IO.FileNotFoundException”类型的异常,但未在用户代码中处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows Phone 8.1中使用xmpp.in开发聊天应用程序我的服务器连接部分我得到这个奇怪的错误。请帮助我



类型例外SConnect.exe中发生'System.IO.FileNotFoundException'但未在用户代码中处理



附加信息:无法加载文件或程序集'System.Windows,Version = 2.0.5.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e'或其依赖项之一。系统找不到指定的文件。



到达这里objXmppclient = new XMPPClient();



< pre lang =c#> public XMPPClient Get_XMPPConnection( string useid, string pswd)
{
if (objXmppclient == null
{

objXmppclient = new XMPPClient(); -------------这里得到错误
objXmppclient.JID = useid + @ taurus;

objXmppclient.Password = pswd;
objXmppclient.Server = ServerIPAddress;
// objXmppclient.Port = 9090;
objXmppclient.AutoReconnect = ;
objXmppclient.RetrieveRoster = true ;
objXmppclient.AutoAcceptPresenceSubscribe = true ;
objXmppclient.AttemptReconnectOnBadPing = true ;
objXmppclient.AutoAcceptPresenceSubscribe = true ;
objXmppclient.Connect();
}
return objXmppclient;
}

解决方案

好像你不是唯一有这个问题的人。

< blockquote class =quote>

Quote:

在我的情况下,没有可供选择的System.Windows引用。

我必须包含一个引用到WindowsBase



(以防链接坏了。)



请参阅Stack Overflow问题:无法找到System.Windows程序集 [ ^ ]





我希望其中一个解决方案可以帮到你。



[更新]

你可以试试实施 AppDomain.AssemblyResolve事件 [< a href =https:// msdn .microsoft.com / zh-cn / library / system.appdomain.assemblyresolve(v = vs.110).aspxtarget =_ blanktitle =New Window> ^ ]

获取有关缺少的程序集的更多详细信息可能很有用。

您也可以指向要在此方法中加载的程序集。

请参阅解决装配负荷 [ ^ ]了解更多相关信息。



尽快在代码中添加此行。

  public  静态  void  Main() //  只是一个例子,你的代码可能不同 
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve + = new ResolveEventHandler(MyResolveEventHandler);

// 您的其他代码
// ...
}

// 在此方法中设置断点或检查输出。
// 然后看看会发生什么并更改代码以便它适合您
private < span class =code-keyword> static 程序集MyResolveEventHandler( object sender,ResolveEventArgs args)
{
Console.WriteLine( 解析{0},e.Name); // 或Debug.WriteLine
return Assembly.Load(e.Name);
}


Hi iam devoloping a chat app in windows phone 8.1 using xmpp.in my server connection part im getting this strange error.pls help me

An exception of type 'System.IO.FileNotFoundException' occurred in SConnect.exe but was not handled in user code

Additional information: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.

getting here objXmppclient = new XMPPClient();

public XMPPClient Get_XMPPConnection(string useid, string pswd)
{
       if (objXmppclient == null)
       {

        objXmppclient = new XMPPClient();-------------here getting error
        objXmppclient.JID = useid + "@taurus";

        objXmppclient.Password = pswd;
        objXmppclient.Server = ServerIPAddress;
        //objXmppclient.Port = 9090;
        objXmppclient.AutoReconnect = true;
        objXmppclient.RetrieveRoster = true;
        objXmppclient.AutoAcceptPresenceSubscribe = true;
        objXmppclient.AttemptReconnectOnBadPing = true;
        objXmppclient.AutoAcceptPresenceSubscribe = true;
        objXmppclient.Connect();
    }
    return objXmppclient;
}

解决方案

Seems like you are not the only one with this problem.

Quote:

In my case there was no System.Windows reference available to pick up.
I had to include a reference to WindowsBase


(Just in case the link is broken.)

See this Stack Overflow question: Can not find System.Windows Assembly[^]


I hope one of the solutions there will help you.

[UPDATE]
You can try to implement the AppDomain.AssemblyResolve Event[^]
It might be useful for getting more details about the missing assembly.
You can also point to the assembly you want to load in this method.
See Resolving Assembly Loads[^] for more information about this.

Add this lines as early as possible in your code.

public static void Main() // Just an example, your code is probably different
{
    AppDomain currentDomain = AppDomain.CurrentDomain;
    currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);

    // Your other code
    // ...
}

// Set a break point in this method or check the output.
// Then see what happens and change the code so it works for you
private static Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
{
    Console.WriteLine("Resolving {0}", e.Name);  // Or Debug.WriteLine
    return Assembly.Load(e.Name);
}


这篇关于SConnect.exe中出现“System.IO.FileNotFoundException”类型的异常,但未在用户代码中处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆