minolin / acplugins

R&D about the upcoming server plugin infrastrucure of Assetto Corsa, driving simulator by Kunos simulazioni
Apache License 2.0
18 stars 4 forks source link

Mono doesn't read app.config #13

Closed minolin closed 9 years ago

minolin commented 9 years ago

Jaye is trying to get the minorating plugin working on linux/mono. My experience with mono is "install, run" - never had problems.

I tried to set the config file via

var configFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, System.AppDomain.CurrentDomain.FriendlyName + ".config"); Console.WriteLine("Read config file " + configFile); AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", configFile);

Still not a single entry in the config manager.

Solution 1: Create another IConfig implementation, maybe for .ini files (I'm sure some Admins prefer inis to .config). Problem: have to configure the wcf endpoint in code as well - in this specific case.

Solution 2: ???

flitzi commented 9 years ago

hmm.. strange. I have not much experience with mono. But from googling it seems, that although some people have problems with mono and app.config, in theory it should work. Perhaps instead having another file for loading settings one could load the XML of the exe.config manually.

flitzi commented 9 years ago

Of course it might be different for linux/mono, but i've just tried string val = ConfigurationManager.AppSettings[key]; in mono and it worked without problems.

You don't recompile or rename files for use in linux/mono, do you?

Perhaps it is a problem specific to the mono version Jaye is using?

flitzi commented 9 years ago

Not really related to app.config but with mono in General.

I just ran the .NET Portability Analyzer on the MinoRatingPlugin and it seems there are some problems with the autogenerated code of the LiveDataDumpClient:

.NET Portability Report Summary Assembly .NET Framework 4.6 Mono 4.5 acPlugins4net 100% 100% MinoRatingPlugin 100% 96,85%

MinoRatingPlugin Target type .NET Framework 4.6 Mono 4.5 Recommended changes System.ServiceModel.ClientBase`1

ctor(System.ServiceModel.Channels.Binding,System.ServiceModel.EndpointAddress)

ctor(System.String,System.String)

ctor(System.String)

ctor

ctor(System.String,System.ServiceModel.EndpointAddress)

get_Channel

No idea if the Portability Analyzer is reliable. Have you run the MinoRatingPlugin successfully in mono before?

minolin commented 9 years ago

No, but a lot of other stuff, without problems I could remember. I'm almost sure there has been Wcf clients involved, but it might be done programatically.

So try a simlpe ini-parser/writer?

flitzi commented 9 years ago

I'm not sure if you have read my other comments. Like I said, if reading app.config really does not work in Linux I would suggest to keep the same app.config file, but implement a different IConfig implementation that reads the app.config XML file manually.

minolin commented 9 years ago

True, somehow I did only read your last message. Sorry.

string val = ConfigurationManager.AppSettings[key]; in mono and it worked without problems.

I will try to remove the WCF stuff from the .config, maybe it's using something the mono config manager doesn't like. Good path. Ty for your idea (I'm amazed how ... my problem-finding-creativity goes down theese days. You're incredibly helpful)

minolin commented 9 years ago

Thank you thomas, it was the wcf stuff inside the config. Mono is running now (at least until another crash during runtime)