Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it just me? NullReferenceException in paket.exe #319

Closed
haf opened this issue Nov 1, 2014 · 18 comments
Closed

Is it just me? NullReferenceException in paket.exe #319

haf opened this issue Nov 1, 2014 · 18 comments

Comments

@haf
Copy link
Member

haf commented Nov 1, 2014

On this source tree

It's getting a bit old. So far I have successfully converted zero projects to paket. =s

mono tools/paket.exe convert-from-nuget -v
Paket version 0.11.10.0
Paket failed with:
   Object reference not set to an instance of an object
StackTrace:
    at Paket.NuGetConvert [email protected] (System.Xml.XmlNode node) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.OptionModule.Map[XmlNode,Auth] (Microsoft.FSharp.Core.FSharpFunc`2 mapping, Microsoft.FSharp.Core.FSharpOption`1 option) [0x00000] in <filename unknown>:0
  at Paket.NuGetConvert [email protected] (IEnumerable`1& next) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[Paket.PackageSources PackageSource].MoveNextImpl () [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1[Paket.PackageSources PackageSource].System-Collections-IEnumerator-MoveNext () [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.SeqModule.ToList[PackageSource] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
  at Paket.NuGetConvert.applyConfig (Paket.NugetConfig config, System.Xml.XmlDocument doc) [0x00000] in <filename unknown>:0
  at Paket.NuGetConvert [email protected] (Paket.NugetConfig config, System.Xml.XmlDocument doc) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.ListModule.loop@151-20[XmlDocument,NugetConfig] (Microsoft.FSharp.Core.FSharpFunc`3 f, Paket.NugetConfig s, Microsoft.FSharp.Collections.FSharpList`1 xs) [0x00000] in <filename unknown>:0
  at Microsoft.FSharp.Collections.ListModule.Fold[XmlDocument,NugetConfig] (Microsoft.FSharp.Core.FSharpFunc`2 folder, Paket.NugetConfig state, Microsoft.FSharp.Collections.FSharpList`1 list) [0x00000] in <filename unknown>:0
  at Paket.NuGetConvert.readNugetConfig () [0x00000] in <filename unknown>:0
  at Paket.NuGetConvert.ConvertFromNuget (Boolean force, Boolean installAfter, Boolean initAutoRestore) [0x00000] in <filename unknown>:0
  at Paket.Program [email protected] (Microsoft.FSharp.Core.Unit unitVar) [0x00000] in <filename unknown>:0
  at <StartupCode$paket>.$Paket.Program.main@ () [0x00000] in <filename unknown>:0
 mono --version
Mono JIT compiler version 3.10.0 ((detached/e204655 Mon Oct 13 08:50:28 EDT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug
    LLVM:          yes(3.4svn-mono-(detached/e656cac)
    GC:            sgen
@forki
Copy link
Member

forki commented Nov 1, 2014

let me check.

@forki
Copy link
Member

forki commented Nov 1, 2014

convert worked for me. Without any problems. Let me send you a pull request to suave

will still try to reproduce your error.

@haf
Copy link
Member Author

haf commented Nov 1, 2014

Funny. I'm on a OS X 10.9.5 mac if that helps.

@forki
Copy link
Member

forki commented Nov 1, 2014

SuaveIO/suave#136

@haf
Copy link
Member Author

haf commented Nov 1, 2014

Great. I've merged it to master now.

Do you want me to give you any more data on the null reference exception?

@forki
Copy link
Member

forki commented Nov 1, 2014

yes. please.

I tried to reproduce, but no luck.

I assume the error is at
https://github.com/fsprojects/Paket/blob/master/src/Paket.Core/NugetConvert.fs#L25

2014-11-01 15:55 GMT 01:00 Henrik Feldt [email protected]:

Great. I've merged it to master now.

Do you want me to give you any more data on the null reference exception?


Reply to this email directly or view it on GitHub
#319 (comment).

@forki
Copy link
Member

forki commented Nov 1, 2014

ok. seems the error is with a nuget.config - probably one which exists on your machine and not on mine - somehwere in Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) "nuget"

@haf
Copy link
Member Author

haf commented Nov 1, 2014

Yes, I've found it...

The problem is that you loop over each key of the add-elements in packageSources, but for some keys you can't assume you have a credential. E.g. for the key https://www.nuget.org/api/v2/ there's no corresponding element in the packageSourceCredentials element.

@haf
Copy link
Member Author

haf commented Nov 1, 2014

On this line you assume SelectNodes doesn't return null.

@forki
Copy link
Member

forki commented Nov 1, 2014

thanks. will rewrite that part.

@forki
Copy link
Member

forki commented Nov 1, 2014

ok this is now super verbose but hopefully safer. @theimowski could you please review my changes? Thx

@haf
Copy link
Member Author

haf commented Nov 1, 2014

Now it fails with:

Paket failed with:
   Could not retrieve data from https://tc/httpAuth/app/nuget/v1/FeedService.svc/Packages?$filter=Id eq 'RazorEngine'
 Message: The remote server returned an error: (401) Unauthorized.

Because I have a nuget source that's authorized.

@haf
Copy link
Member Author

haf commented Nov 1, 2014

ok, now I've spent too much time on this again :p. See you in a month.

@forki
Copy link
Member

forki commented Nov 1, 2014

Can you send me your nuget config? With modified password of course. Will
make it a unittest
On Nov 1, 2014 4:39 PM, "Henrik Feldt" [email protected] wrote:

Now it fails with:

Paket failed with:
Could not retrieve data from https://tc/httpAuth/app/nuget/v1/FeedService.svc/Packages?$filter=Id eq 'RazorEngine'

Because I have a nuget source that's authorized.


Reply to this email directly or view it on GitHub
#319 (comment).

@haf
Copy link
Member Author

haf commented Nov 1, 2014

Done

@theimowski
Copy link
Member

my guess would be this line - nuget supports also encrypted passwords

@theimowski
Copy link
Member

... which convert-nuget does not, my bad I didn't handle that.

forki added a commit that referenced this issue Nov 1, 2014
@forki
Copy link
Member

forki commented Nov 1, 2014

@haf thanks. I used it as a first sample. should work in 0.11.11

I'm now starting to cleanup and add couple of new test cases.

@forki forki closed this as completed in d039e1c Nov 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants