2012-04-26 30 views
5

Chúng tôi đang gặp phải tai nạn trên các máy khác nhau trong thiết kế VS2010 WPF trong kịch bản sau đây:Nguyên nhân gây ra VS 2010 SP1 WPF Designer bị lỗi?

  • VS 2010 SP1 được cài đặt
  • 64 Bit Windows 7
  • Tham chiếu đến NHibernate.dll (Phiên bản 1.2.0.712)

Để tái tạo các lỗi, tạo ra một giải pháp WPF mới, thực hiện các hành động sau đây:

  • tạo ra một giải pháp mới WPF
  • mở cửa sổ chính, thêm một textbox với nó, thiết lập một số văn bản tĩnh
  • thêm một tham chiếu đến FluentNhibernate.dll, phiên bản 1.2.0.712
  • sạch và xây dựng lại các giải pháp
  • mở cửa sổ chính trong thiết kế lại, chỉnh sửa văn bản
  • trong thiết kế, bấm vào bên trái của cửa sổ, sau đó trở lại vào textbox lại

không có dữ liệu/lệnh Bindings, không có mã số tham chiếu cúm chức năng entNHibernate hoặc bất cứ điều gì rất tinh vi, chỉ cần một giải pháp WPF mới với XAML sau trong MainWindow.xaml:

<Window x:Class="testWpfApplication2.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="800" 
    Title="MainWindow" Height="350" > 
    <Grid> 
    <TextBox Text="yxcydfdssdfsdfdsfsdsddsasdyxcasd" /> 
    </Grid> 
</Window> 

Đây là stacktrace hoàn chỉnh:

System.Reflection.TargetInvocationException 
Exception has been thrown by the target of an invocation. 
    at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) 
    at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) 
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 
    at System.Delegate.DynamicInvokeImpl(Object[] args) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 

System.NullReferenceException 
Object reference not set to an instance of an object. 
    at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeTypeVariable(Type type) 
    at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type) 
    at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type) 
    at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetRuntimeType(Type type) 
    at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.TryGetRuntimeType() 
    at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.EnsureRuntimeType(Type type) 
    at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider.GetRuntimeType(Type reflectionType) 
    at MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.VsReflectionResolver.GetRuntimeType(Type reflectionType) 
    at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.CachingReflectionResolver.GetRuntimeType(Type reflectionType) 
    at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.Microsoft.Windows.Design.Metadata.IReflectionResolver.GetRuntimeType(Type reflectionType) 
    at MS.Internal.Metadata.ClrType.get_RuntimeMember() 
    at MS.Internal.Metadata.ClrMember`1.Microsoft.Windows.Design.Metadata.Reflection.IReflectionMember.get_MemberInfo() 
    at MS.Internal.Metadata.ClrType.Equals(Object obj) at System.Collections.Generic.ObjectEqualityComparer`1.Equals(T x, T y) 
    at System.Collections.Generic.Dictionary`2.FindEntry(TKey key) 
    at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.<>c__DisplayClass5.<FindAttachableProperties>b__4(ITypeMetadata walkType) 
    at MS.Internal.Design.Metadata.Xaml.XamlType.<GetAllAttachableProperties>d__7.MoveNext() 
    at MS.Internal.Design.Metadata.Xaml.XamlType.<FindAttachableProperties>d__0.MoveNext() 
    at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.<FindAttachableProperties>d__7.MoveNext() 
    at MS.Internal.VirtualModel.VirtualModelPropertyCollection.<GetUncachedProperties>d__0.MoveNext() 
    at System.Linq.Buffer`1..ctor(IEnumerable`1 source) 
    at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) 
    at MS.Internal.VirtualModel.VirtualModelPropertyCollection.GetEnumerator() 
    at MS.Internal.Designer.PropertyEditing.Model.Properties.ModelPropertyMerger.<GetFirstProperties>d__0.MoveNext() 
    at MS.Internal.Designer.PropertyEditing.Views.PropertyEntryReader.RedraftEntries(IPropertyViewManager viewManager, Selection selection, Boolean attachedOnly, IEventCodeBehindProxy eventCodeBehindProxy, CategoryList categoryList) 
    at MS.Internal.Designer.PropertyEditing.PropertyInspector.UpdateCategories(Selection selection, Boolean attachedOnly, IEntryReader entryReader) 
    at MS.Internal.Designer.PropertyEditing.PropertyInspector.RefreshPropertyList(Boolean attachedOnly) 
    at MS.Internal.Designer.PropertyEditing.PropertyInspector.OnSelectionChangedIdle() 

MS đã xác nhận điều này như một Bug SP1, nhưng đối với một kết quả thỏa đáng, tôi cần phải hiểu thêm về vấn đề này ...

Điều gì gây ra điều này, tại sao nó chỉ xảy ra khi thêm FNH, tại sao chỉ khi thêm nó từ một vị trí nhất định (assembly là giống nhau - chúng tôi đã so sánh quá mức)? Nếu không có SP1, nó hoạt động ...

+1

Điều cuối cùng tôi đã thực hiện về vấn đề này đã được tải FluentNHibernate sourcecode (mới nhất) và tham khảo nó như là một dự án. Điều này hoạt động tốt, vì vậy về cơ bản nó phải là một cái gì đó với các dll trong câu hỏi. Có Visual Studio thực hiện bất cứ điều gì như tính toán kiểm tra trên DLL tham chiếu? –

+0

Điều này có xảy ra với bất kỳ kiểm soát nào bạn sử dụng không? Nó có xảy ra khi không có điều khiển bên trong cửa sổ không? Và làm thế nào bạn cài đặt NHibernate? – Kcvin

Trả lời

0

Đôi khi chúng ta làm được việc này bằng cách thêm

if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) 
       return; 

trong trường hợp tải của bộ điều khiển vi phạm

Các vấn đề liên quan