Petroware / Uom-Public

UoM is a units of measurement library
https://petroware.no/uom.html
Apache License 2.0
14 stars 4 forks source link

Fails to initialize in .NET Core 2.0 #1

Closed ugumba closed 5 years ago

ugumba commented 6 years ago

Hi! I appreciate you making this available! Initialization fails to open the stream for the embedded WITSML units XML:

System.TypeInitializationException : The type initializer for 'Petroware.Uom.UnitManager' threw an exception. ---- System.ArgumentNullException : Value cannot be null. Parameter name: stream at Petroware.Uom.UnitManager.GetInstance()

Second, have you considered publishing a nuget package, or even the .NET source code?

Thanks, Robert

Edit: Removed comment about yellow triangle - this was caused by other factors.

petrowareas commented 6 years ago

Hi Robert,

The .Net source code is there: ./Petroware/Uom/.. Can you use it to pinpoint the source of the exception? Possibly on reading the unit xml.

Petroware AS

ugumba commented 6 years ago

Ah, thanks - somehow I missed that folder! When adding the contents of the folder into a Petreoware\Uom folder in my netstandard20 project, and marking the embedded resources, it works fine without any changes to the code.

In your DLL, the embedded resources are named "Uom.Net.Petroware.Uom.*".
The "Petroware.Uom" comes from the namespace/folder structure in your csproj, and "Uom.Net" must be the name of your csproj (which is not included in your source code folder).

However, as your assembly is just named "Uom", the resources can't be located.

So it seems the problem is that you've named the assembly differently from the csproj.

petrowareas commented 6 years ago

Great, thanks,

You are right; The library is not built from the GitHub code, but copied from the original source. We will fix this is due time.

Petroware AS