lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johannes von Drachenfels (JIRA)" <j...@apache.org>
Subject [jira] Created: (LUCENENET-324) System.TypeInitializationException on linux
Date Wed, 09 Dec 2009 15:37:18 GMT
System.TypeInitializationException on linux
-------------------------------------------

                 Key: LUCENENET-324
                 URL: https://issues.apache.org/jira/browse/LUCENENET-324
             Project: Lucene.Net
          Issue Type: Bug
         Environment: debian, vbnc, Visual Basic
            Reporter: Johannes von Drachenfels
            Priority: Minor


Problem:
When the environment variable "OS" is not present a failure occurs when initializing an  Lucene.Net.Store.FSDirectory

--------------------------------------------------------------------

Exception:
--------------------------------------------------------------------
> ################################
>
> System.TypeInitializationException: An exception was thrown by the 
> type initializer for Lucene.Net.Store.FSDirectory --->
> System.TypeInitializationException: An exception was thrown by the 
> type initializer for Lucene.Net.Util.Constants --->
> System.NullReferenceException: Object reference not set to an instance 
> of an object
>
>    at Lucene.Net.Util.Constants..cctor () [0x00000]
>
>    --- End of inner exception stack trace ---
>
>    at Lucene.Net.Store.FSDirectory..cctor () [0x00000]
>
>    --- End of inner exception stack trace ---
>
>    at ConsoleApplication1.Module1.Main () [0x00000]


Solution:
--------------------------------------------------------------------

This is probably caused by this line in Lucene.Net.Util.Constants.cs:

public static readonly System.String OS_NAME = System.Environment.GetEnvironmentVariable("OS");

Try to assign some value to the env var "OS":

	OS=foo mono yourapp.exe

Robert

Workarround:
--------------------------------------------------------------------

            'bugfix:
            Dim OSSTRING As String = ""
            Try
                OSSTRING = System.Environment.GetEnvironmentVariable("OS")
            Catch ex As Exception
                OSSTRING = ""
            End Try
            If OSSTRING.Trim.Length = 0 Then
                System.Environment.SetEnvironmentVariable("OS", "linux")
            End If

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message