lformella/xdcc-grabscher

Can't start XG 3.1.0.1 on Win7 x64

copen2 opened this issue · 6 comments

Always crashes on startup.

crash

What does the first few lines say?

Try:
https://github.com/lformella/xdcc-grabscher/wiki/troubleshooting
System.MissingMemberException: The server factory could not be located for the given input: Nowin

Make sure you have all the required nuget package dlls in the \XG.Application\bin folder, in particular Nowin.dll and Microsoft.Owin.Host.HttpListener.dll.

I have both DLLs in the application EXE's folder (there is no bin folder). Looks like the problem is some sort of missing API (get_CurrentManagedThreadID). Here is the full log:

C:\Program Files (x86)\XG\XG>XG.Application.exe

Unhandled Exception: System.MissingMethodException: Method not found: 'Int32 Sys
tem.Environment.get_CurrentManagedThreadId()'.
at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryLoader.d__0..ctor(Int32 <>1__state)
at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryLoader.GetTypeAndMethodN
ameForConfigurationString(String configuration)
at Microsoft.Owin.Hosting.ServerFactory.ServerFactoryLoader.Load(String serve
rName)
at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveServerFactory(StartCont
ext context)
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions opt
ions)
at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider service
s, StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start[TStartup](StartOptions options)
at XG.Plugin.Webserver.Plugin.StartRun()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

See:
http://stackoverflow.com/questions/15569664/system-missingmethodexception-int32-system-environment-get-currentmanagedthread

CurrentManagedThreadId is a .NET 4.5 property, so you will need 4.5 to run the code. See Iterator blocks, missing methods, and .NET 4.5 for an analysis of how this problem might occur.

In short:

If you build your application (targeted at .NET 4.0) on a system with .NET 4.5 installed, it will use 4.5 as basis for the compilation, because the .NET 4.0 Framework is always overwritten by .NET 4.5.

If your application then also uses yield return, it will fail on systems having only 4.0 installed because the implementation of this statement uses a new property when compiled for the 4.5 Framework.

To solve it, make sure your compiler system has the 4.0 reference assemblies.

http://stackoverflow.com/questions/8058832/system-missingmethodexception-method-not-found

This is a problem which can occour when there is an old version of a DLL still lingering somewhere around. Make sure that the latest assemblies are deployed and no duplicated older assemblies are hiding in certain folders. Your best bet would be to delete every built item and rebuild/redeploy the entire solution.

https://github.com/lformella/xdcc-grabscher#on-linux-with-mono

You need at least mono 3.x because some needed libs are running on .net 4.5 wich is not supported in earlier versions.

Relevant code is in the stack trace, that you provided.

Unhandled Exception: System.MissingMethodException: Method not found: 'Int32 Sys
tem.Environment.get_CurrentManagedThreadId()'.
....
at Microsoft.Owin.Hosting.WebApp.StartTStartup
at XG.Plugin.Webserver.Plugin.StartRun()
....

I'ld recommend installing .net 4.5, if that doesn't work, try rebuilding the solution after you have .net 4.5 installed.

EDIT: for any mac/linux users reading this in the future, would probably need to install mono 3.x or whatever the latest version is.

You, sir, are a genius. Installing .NET 4.5 manually resolved the issue. I've been dealing with this for months. Thank you!

I ask myself how you installed XG?
I configured the installer to require an installed .net 4.5 package. Did you see any warning that your version is lower?

I used the installer. 3 different installers for 3.x, and all resulted in these crashes on startup. I saw no warnings about versions of .net. Sounds like the installer should require 4.5 to avoid this in the future for others.