[Mono-list] Configuration.SectionGroups type cast problem

2015-08-24 Thread Danny Gorton
Hello all.  I searched the list archives (using google) and couldn't find
anything related to this issue.

My environment is:

Linux raspberrypi 3.12.35+ #730 PREEMPT Fri Dec 19 18:31:24 GMT 2014 armv6l
GNU/Linux and Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1).
I develop on Windows with VS.NET and automate builds on Linux/Mono and test
on Windows and Raspbian (ARM) and Ubuntu.  Most of the time it *just
works*, but every once in a while I run into some weird differences between
.NET and Mono.

My product is a daemon with ServiceStack 3.9.x embedded to provide web
services.  I have features for altering server configuration options
through a web UI.  When that web service is called it looks for specific
ConfigurationSection instances (some custom, some standard) by iterating
the configuration hierarchy, through the SectionGroups
(ConfigurationSectionGroupCollection) on downward until it finds a match.
Here is one example:

foreach (Config.ConfigurationSectionGroup group in
_config.SectionGroups)
{
..
}

In this code _config is a System.Configuration.Configuration instance and
this code works on .NET (Windows 7), but breaks on Mono on the foreach line
with:

System.InvalidCastException: Cannot cast from source type to destination
type.

For some reason the contents of SectionGroups don't seem to be
ConfigurationSectionGroup objects. So I put in some debug logging like this:

if (_log.IsDebugEnabled)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(string.Format(Configuration has [{0}]
section groups:, _config.SectionGroups.Count));
foreach(object o in _config.SectionGroups)
{
sb.AppendLine(string.Format(\tSectionGroup of type:
[{0}] is [{1}], o.GetType().FullName, o));
}
_log.Debug(sb.ToString());
}

The output on .NET shows the right types (don't have an example handy right
now).  The output on Mono looks like:

2015-08-23 21:59:14,945 [Threadpool worker] DEBUG raspberrypi
ConfigurationHandler.getSection (line 0) - Configuration has [5] section
groups:
SectionGroup of type: [System.String] is [system.web]
SectionGroup of type: [System.String] is [system.net]
SectionGroup of type: [System.String] is [system.serviceModel]
SectionGroup of type: [System.String] is [system.transactions]
SectionGroup of type: [System.String] is [apac]

As you can see, the types are string and the values are the names of the
section groups in question.  I've looked at the code history for
ConfiguratoinSectionGroupCollection and Configuration.SectionGroups and I
don't see where either was ever written to store just simple strings,
though I may be missing something.

My configSections element is:
  configSections
sectionGroup name=apac
type=System.Configuration.ConfigurationSectionGroup, System.Configuration,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
  section name=default
type=Apac.Configuration.XmlSerializingConfigSection, apac.core/
  section name=pluginPaths
type=Apac.Configuration.NameMultipleValueSectionHandler, apac.core/
/sectionGroup
  !-- APAC Messaging Configuration--
section
 name=apac.messaging
 type=Apac.Configuration.MessageControllerConfigSection, apac.core
 restartOnExternalChanges=true /

  !-- APAC Licensing Configuration--
  section name=apac.licensing

 type=Apac.Licensing.Configuration.LicensingConfigurationSection,
apac.licensing
   restartOnExternalChanges=true/
  /configSections

Anyone have any idea why this would be happening?

Regards,
Danny
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Mono and Dallas/Maxim 1-Wire

2011-01-06 Thread Danny Gorton
Hello list,

This may be slightly off-topic for the Mono list, but I'm making a
cross-platform product on Windows/Linux using .NET/Mono and have until now
had really good successes with making my components work seamlessly on the
two platforms using the appropriate native libraries and P/Invoke
(DllImport).  Now I'm trying to integrate 1-Wire sensors into the mix and
I'm having trouble finding the code module(s) I need.  It may be due to my
lack of a traditional C background, or whatever.

I just wanted to make a quick poll to see if anyone knows of a
cross-platform version, or at least a dynamic library, of the 1-Wire
interface:  http://www.maxim-ic.com/products/1-wire/software/.  I've looked
at all of these (except Java, which isn't an option) and they seem to be
really geared toward Windows - the .NET components P/Invoke Windows (or CE)
libraries for serial comms.  I don't have enough C-foo to make a dynamic
library out of the public domain component(s), but that is what I intend to
tackle if I can't find that it has already been done.

I *can* make distinct plug-ins for *nix and Windows if necessary, but would
rather not.  At any rate, I need to target Linux first, and at the moment
I'm stuck. So before I dig in to get really dirty I figured I'd ping this
list.  Also, I have noticed owfs (http://owfs.org/), which got me excited
until I realized that it put me in nearly the same boat - no dynamic library
that I can call from C#.

Any and all help is appreciated, even if it poses a way to solving the
problem I haven't mentioned or alluded to.

Thanks in advance,
Danny
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list