Changes from 1.61 to 1.70 break code?

Sep 7, 2012 at 4:36 PM

Hi,

I just updated the library from 1.60 to 1.7 and now some of the functions don't work.

For example, I would previously use NSID like this

1: Dim a As New NsIdOption
2: Dim oEncoder As New System.Text.ASCIIEncoding
3:  Dim data As Byte() = oEncoder.GetBytes("1234")
4:  a.Payload = data
5: query.EDnsOptions.Options.Add(a)

Can anyone give me an example with the updated library?  It doesn't see to work like this any more as the payload is read only.

Also, I'm getting a lot of Errors like        Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:
    'Public Sub New(name As String, timeToLive As Integer, textParts As System.Collections.Generic.IEnumerable(Of String))': Argument matching parameter 'timeToLive' narrows from 'Object' to 'Integer'.
    'Public Sub New(name As String, timeToLive As Integer, textParts As System.Collections.Generic.IEnumerable(Of String))': Argument matching parameter 'textParts' narrows from 'Object' to 'System.Collections.Generic.IEnumerable(Of String)'.
    'Public Sub New(name As String, timeToLive As Integer, textData As String)': Argument matching parameter 'timeToLive' narrows from 'Object' to 'Integer'.
    'Public Sub New(name As String, timeToLive As Integer, textData As String)': Argument matching parameter 'textData' narrows from 'Object' to 'String'.

 

type errors since rebuilding the newer version and trying to use it with my code.

Has a lot changed since 1.60 that caused this with 1.7? I rolled back to 1.6 and all is fine.

 

Coordinator
Sep 8, 2012 at 8:06 AM

Hi,

first problem: Try this:

Dim oEncoder As New System.Text.ASCIIEncoding
Dim data As Byte() = oEncoder.GetBytes("1234")
Dim a As New NsIdOption(data)
query.EDnsOptions.Options.Add(a)

Second problem:

I added a new (additional) constructur to the TxtRecord. Seems that you used the constructor of the TxtRecord without explicit type conversion of the parameters and Visual Basic can now not guess the right constructor.

Sep 8, 2012 at 1:23 PM

Thanks.  Added CInt and Cstr.  All working