我有一个适用于.NET 4.0的.NET应用程序 - 虽然该应用程序公开了它的app.config但我没有它的源代码
但 .
我已经安装了Visual Studio 2012和.NET 4.5 . 突然,.NET 4.0应用程序在某些地方抛出了异常 - 我用Reflector分析了在应用程序的WPF部分中的InitializeComponent()中抛出了异常 .
Uri resourceLocator = new Uri("/Some.Assembly;someuri/someuri/somefile.xaml", UriKind.Relative);
例外是:
The invocation of the constructor on type 'DevExpress.Xpf.Grid.GridControl' that matches the specified binding constraints threw an exception.
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
不幸的是,我无法判断是否有任何内部异常 .
如果我卸载.NET 4.5并安装.NET 4.0,则不会抛出异常,但我无法使用VS 2012 .
我试图将这些行添加到app.config中,但没有成功 .
<startup useLegacyV2RuntimeActivationPolicy="true" >
<supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0" />
<requiredRuntime version="v4.0.30319" />
</startup>
如何强制应用程序仅使用4.0和4.0?它甚至可能吗? .NET 4.5与4.0程序集混合在一起吗?
3 回答
看看这篇文章 . http://www.west-wind.com/weblog/posts/2012/Mar/13/NET-45-is-an-inplace-replacement-for-NET-40 . 它描述了安装.net 4.5时实际发生的情况 . 您可以要求程序的供应商使用最新版本的DevExpress控件重新编译它 .
可能是个bug .
我们的控件完全支持从版本12.1.6开始的Visual Studio 2012和.NET Framework 4.5 . 我们还将很快发布与.NET Framework 4.5的运行时兼容性版本11.2.13 .
http://www.devexpress.com/Support/Center/Question/Details/Q430478
有什么方法可以将调试器附加到它并查看异常是什么?
.Net有两种不同的风格 . 您使用的版本可能是有限的.Net(客户端配置文件),您尝试运行的程序需要完整版本 . 但根据http://msdn.microsoft.com/en-us/library/cc656912.aspx 4.5仅提供完整版 .