Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/macdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Karlaš <david.karlas@xamarin.com>2016-11-23 16:41:04 +0300
committerDavid Karlaš <david.karlas@xamarin.com>2016-11-23 16:41:04 +0300
commitde35b08e5af2ea43a907a5529b4dc36a793c8ddf (patch)
treed205525bec93f385e8b428b627e654af39c99ef2
parent2a23455108ea8226f17d5d21007cb95f1e41dc65 (diff)
I think something changed in Xamarin.Mac recently which is causing ConfigurationManager.AppSettings to be null
Resulting in MonoDoc.dll and Lucene.Net crashing(NullReferenceException) when trying to access ConfigurationManager.AppSettings
-rw-r--r--AppDelegate.cs15
-rw-r--r--macdoc.csproj1
2 files changed, 15 insertions, 1 deletions
diff --git a/AppDelegate.cs b/AppDelegate.cs
index 956e6c4..1f30dc3 100644
--- a/AppDelegate.cs
+++ b/AppDelegate.cs
@@ -14,6 +14,8 @@ using ObjCRuntime;
using Monodoc;
using System.Text;
+using System.Reflection;
+using System.Configuration;
namespace macdoc
{
@@ -89,7 +91,18 @@ namespace macdoc
if (extraUncompiledDocs != null)
foreach (var dir in extraUncompiledDocs)
RootTree.AddUncompiledSource (dir);
-
+
+ if (ConfigurationManager.AppSettings == null)
+ {
+ Logger.Log("Setting default settings because ConfigurationManager.AppSettings is null");
+ var keyValueConfigurationCollection = new KeyValueConfigurationCollection();
+ keyValueConfigurationCollection.Add("docPath", "/Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc/");
+ keyValueConfigurationCollection.Add("docExternalPath", "");
+ typeof(Config).GetField("exeConfig", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, keyValueConfigurationCollection);
+ Lucene.Net.Support.AppSettings.Set("java.version", "");
+ Lucene.Net.Support.AppSettings.Set("java.vendor", "");
+ }
+
Root = RootTree.LoadTree ();
if (extraDocs != null)
diff --git a/macdoc.csproj b/macdoc.csproj
index 28cfe13..f6bbda8 100644
--- a/macdoc.csproj
+++ b/macdoc.csproj
@@ -51,6 +51,7 @@
<HintPath>lib\monodoc.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Mac" />
+ <Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyDocument.cs">