MadMilkman.Ini icon indicating copy to clipboard operation
MadMilkman.Ini copied to clipboard

Cannot convert an object of type

Open danielcshn opened this issue 3 years ago • 1 comments

Use this structure in other projects and I had no problems, now I have the following error:

My config.ini

[Game] GameSelect=DE

My code:

Dim setLang As String Dim ini As New IniFile() ini.Load("config.ini") setLang = ini.Sections("Game").Keys("GameSelect").Value

Last line error:

System.InvalidCastException: 'Cannot convert an object of type' System.Collections.Generic.List1 [MadMilkman.Ini.IniSection]' to type 'System.Collections.Generic.IEnumerable`1 [MadMilkman.Ini.IniItem] '.'

My code works with:

Dim setLang As String Dim ini As New IniFile() ini.Load("config.ini") setLang = ini.Sections(0).Keys(0).Value

VisualStudio 2019 Version 16.11.0 .NET Frameworks 3.5 MadMilkman.Ini 1.0.6

Tests: .NET Frameworks 2.0 > NO .NET Frameworks 3.0 > NO .NET Frameworks 3.5 > NO .NET Frameworks 4 > OK .NET Frameworks 4.5 > OK .NET Frameworks 4.6 > OK .NET Frameworks 4.7 > OK

danielcshn avatar Sep 03 '21 18:09 danielcshn

I'm running into this now too, the index workaround works for now.

camprevail avatar Apr 13 '24 21:04 camprevail