Possible bug in Nuget or Nuget Package Updater

Jun 1, 2011 at 6:19 PM

When I update packages I'm routinely left with changes in my web.config that are wholly unrelated.

Before update:

   <system.web>
     <compilation debug="true" targetFramework="4.0">
       <assemblies>
       <dependentAssembly>
         <assemblyIdentity name="Microsoft.Web.Mvc" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>  

After

   <system.web>
     <compilation debug="true" targetFramework="4.0">
       <assemblies>
       <dependentAssembly>
         <assemblyIdentity name="Microsoft.Web.Mvc" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>  
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Web.Mvc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Web.Mvc" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>

I'm not sure whether this only happens when I update from Nuget Package Updater or not, I believe this has occurred with using the standard update too. This web.config is a for a fairly standard MVC3 project.

Developer
Jun 1, 2011 at 6:31 PM

So what's the concrete set of steps you took to get into this state? (like step by step actions you did)

Jun 1, 2011 at 6:49 PM

In this specific case, I had a solution with multiple projects, of those projects some of them were dependent on a nuget package. I applied Update-Package mypack to the solution from the package manager console.

In the past I believe I have seen this behavior using the update GUI also, but I'm not 100% certain.

Jun 1, 2011 at 6:55 PM

@ferventcoder hit something similar that we were not able to repro, so it'd be great to get to the bottom of it.

One puzzling thing about what you have above is that even the "Before" looks wrong. Those <dependentAssembly> nodes are supposed to be in the <runtime><assemblyBinding> section, not <system.web> <compilation> (look at a default MVC3 app to see what I mean). So I would expect the app to be broken before that update.

Do you know how it may have gotten  into  that step?

Jun 1, 2011 at 7:28 PM
davidebbo wrote:

@ferventcoder hit something similar that we were not able to repro, so it'd be great to get to the bottom of it.

One puzzling thing about what you have above is that even the "Before" looks wrong. Those <dependentAssembly> nodes are supposed to be in the <runtime><assemblyBinding> section, not <system.web> <compilation> (look at a default MVC3 app to see what I mean). So I would expect the app to be broken before that update.

Do you know how it may have gotten  into  that step?

The nodes are in the correct place, I was copying from hg's Diff window it must have omitted text without change making them look like they didn't line up. The only issue I've seen with this is that the MVC dependentassembly item gets copied N times.

Jun 1, 2011 at 7:36 PM

I see, thanks for clarifying. If you can find some reproducible steps that get into that state, we'd love to have them. Some questions:

  • If you revert the changes and perform the update again, does it happen consistently?
  • What was the nuget package you were updating?

If there is any way you can trip your solution of anything confidential and share it (or push it to bitbucket) we would hopefully be able to do the exact same thing that you're doing. Would be nice to get this fixed in our upcoming 1.4 if we can get a repro. Thanks!

Jun 15, 2011 at 6:52 PM
davidebbo wrote:

I see, thanks for clarifying. If you can find some reproducible steps that get into that state, we'd love to have them. Some questions:

  • If you revert the changes and perform the update again, does it happen consistently?
  • What was the nuget package you were updating?

If there is any way you can trip your solution of anything confidential and share it (or push it to bitbucket) we would hopefully be able to do the exact same thing that you're doing. Would be nice to get this fixed in our upcoming 1.4 if we can get a repro. Thanks!

I still haven't come across anything concrete however this issue did just appear again to me today and it occured when I installed a package that as far as I know (I created it) there is absolutely no usage whatsoever of the MVC3 dll in the package so I have no idea why it would add the bindingredirects.

Jun 15, 2011 at 7:04 PM

This will be fix in 1.4, which should be out soon (here is the bug).

Jun 15, 2011 at 7:10 PM
davidebbo wrote:

This will be fix in 1.4, which should be out soon (here is the bug).

 

Excellent work guys, I bet this was a strange one to find!