sábado, 3 de março de 2012 11:21
Hello, I've installed Visual Studio 2011 beta, which comes with .NET 4.5 beta, on a machine with Visual Studio 2010 and .NET 4 SP1.
I have a project which is using MEF, built on and targetting .NET 4 that wasn't touched at all, and a unit test making use of MEF which tested open generics support started failing after I installed .NET 4.5 beta. The impression in therefore that for some reason this installation affected a piece of code which wasn't supposed to be influenced at all.
Any idea why this might be happening?
Todas as Respostas
sábado, 3 de março de 2012 17:36
Sure. .NET Framework is an extension of 4.0. Installing the beta software probably (read almost certainly) replaced some 4.0 files with 4.5 updates. I'm sure of this because I had occasion to uninstall .NET 4.5 beta from a system. To get 4.0 working again, I had to reinstall it from the standalone installer.
If you feel the behavior you've experienced is a bug, please report it to the developers via MS Connect, here:
You'll need to sign in with your Live ID.
segunda-feira, 5 de março de 2012 09:19So do you think this is expected? If that's the case what is the point of keep targetting .NET 4 if you get the 4.5 breaking changes anyway?
segunda-feira, 5 de março de 2012 15:19I'm sorry. I did not mean to imply that "this is expected". Quite the contrary. That's why it's important that you report to the developers via Connect, as I linked in my first reply.
segunda-feira, 5 de março de 2012 17:33
Thanks for bringing this to our attention. I'm on the team that delivers MEF - we'd like to get to the bottom of this ASAP, are you able to provide more information?
You mention open generics support, but this is a new feature in 4.5 so I don't understand what you mean by having a unit test for it that now breaks.
Any additional information much appreciated, especially a stack trace or example of code that is broken.
quarta-feira, 7 de março de 2012 11:16
Hi Nicholas, the only ignored test you can see in this file passes when on the machine is installed the .NET fx 4.0 only, and breaks when on the machine is installed also .NET 4.5 beta.
I can understand that the new bits of MEF support open generics, and it's good, I just didn't expect that installing .NET 4.5 beta side-by-side to .NET 4.0 without changing anything in an existing app would imply that the app would start using them.
quinta-feira, 8 de março de 2012 21:12
Simone, thank you very much for the details; I'll loop back with the team and let you know what the status of this is.
terça-feira, 13 de março de 2012 16:15
Simone, we've discussed this within the team and don't expect to change this behavior, given that existing 4.0 applications seem highly unlikely to rely the absence of this feature. If we're missing something and you can see this impacting a production scenario please let us know.
Thanks again for bringing this to our attention, we appreciate your effort in reporting this and in following up.
Nick (BCL Team)
- Marcado como Resposta Barry WangMicrosoft Contingent Staff, Moderator quinta-feira, 15 de março de 2012 05:16
sexta-feira, 17 de agosto de 2012 08:59
We are also experiencing regression in our application after simply installing the .NET 4.5 Framework on a given machine.
We were using the MefContrib open generics support, which is now failing. So, indeed, is the 4.5 open generics. Here's an old example:
class TestClass<T> : ITest<T>
static void Main(string args)
var catalog = new AssemblyCatalog(typeof(Program).Assembly);
var container = new CompositionContainer(new GenericCatalog(catalog));
var tests = container.GetExportedValues<ITest<string>>();
(This can be checked with or without the MefContrib GenericCatalog if using 4.5). If the InheritedExport is commented in and the Export is commented out; it fails with an ugly exception. If the code is as above it works as expected.
This in my mind is a bug as it breaks existing code simply through installing a new version of the Framework.