Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在VS 2015和VS 2013上运行同一段代码时出现问题_C#_Windows_Visual Studio_Visual Studio 2013_Visual Studio 2015 - Fatal编程技术网

C# 在VS 2015和VS 2013上运行同一段代码时出现问题

C# 在VS 2015和VS 2013上运行同一段代码时出现问题,c#,windows,visual-studio,visual-studio-2013,visual-studio-2015,C#,Windows,Visual Studio,Visual Studio 2013,Visual Studio 2015,在Visual Studio 2013和2015中运行一段代码时,我得到了两种不同的结果。在VisualStudio2015上,我得到了一个空引用,在2013年,它以应有的方式工作。此外,Visual Studio 2015在Windows 10上运行,2013在Windows 8.1上运行。这段代码是: private static T FindParentOfType<T>(DependencyObject o) { dynamic parent = VisualTree

在Visual Studio 2013和2015中运行一段代码时,我得到了两种不同的结果。在VisualStudio2015上,我得到了一个空引用,在2013年,它以应有的方式工作。此外,Visual Studio 2015在Windows 10上运行,2013在Windows 8.1上运行。这段代码是:

private static T FindParentOfType<T>(DependencyObject o)
{
    dynamic parent = VisualTreeHelper.GetParent(o);
    return parent.GetType().IsAssignableFrom(typeof(T)) ? parent : FindParentOfType<T>(parent);
}
更新

已在Win10上安装VS2013,但问题仍然存在。VS2013在Win8.1上运行良好

更新

来自Visual Studio 2013 wp 8.1

C:\ProgramFiles(x86)\MSBuild\12.0\bin\Csc.exe/noconfig/nowarn:170117022008/nostlib+/errorreport:prompt/warn:4/define:DEBUG;TRACE/errorendlocation/preferreduilang:en US/reference:“C:\Program Files(x86)\reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\mscorlib.dll”/reference:“C:\Program Files(x86)\reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\Microsoft.CSharp.dll”/reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\mscorlib.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Core.dll”/Reference:“C:\Program Files(x86)\Reference assemblemblems\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.dll”/reference:“C:\Program Files(x86)\reference Assembly\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Net.dll”/reference:“C:\Program Files(x86)\reference Assembly\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Runtime.Serialization.dll”/reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.ServiceModel.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.ServiceModel.Web.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Windows.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Xml.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Xml.Linq.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Xml.Serialization.dll”/debug+/debug:full/filealign:512/optimize-/out:obj\debug\LibraryOfModels.dll/target:library/utf8output BuyMenuClass.cs CastleModel.cs ChampionModel.cs ChatDTO.cs CollectionCombiner.cs Country.cs CurrentUser.cs decorationlist items.cs GameDTO.cs MapTransform.cs MarketplaceModel.cs menufirstmanagemodel.cs NotifyBase.cs Player.csPopupColorPickerModel.cs PopupExtraInfoModel.cs PopUpModel.cs Properties\AssemblyInfo.cs RankingDTO.cs RankingModel.cs ShieldGearModel.cs UnitModel.cs UserDTO.cs WarCalculations.cs“C:\Users\Jonas\AppData\Local\Temp.NETPortable,Version=v4.0,Profile=Profile158.AssemblyAttributes.cs”

从VS 2015赢得10分

C:\ProgramFiles(x86)\MSBuild\14.0\bin\csc.exe/noconfig/nowarn:170117022008/nostlib+/errorreport:prompt/warn:4/define:DEBUG;TRACE/errorendlocation/preferreduilang:en US/reference:“C:\Program Files(x86)\reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\mscorlib.dll”/reference:“C:\Program Files(x86)\reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\Microsoft.CSharp.dll”/reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\mscorlib.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Core.dll”/Reference:“C:\Program Files(x86)\Reference assemblemblems\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.dll”/reference:“C:\Program Files(x86)\reference Assembly\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Net.dll”/reference:“C:\Program Files(x86)\reference Assembly\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Runtime.Serialization.dll”/reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.ServiceModel.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.ServiceModel.Web.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Windows.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Xml.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Xml.Linq.dll”/Reference:“C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile158\System.Xml.Serialization.dll”/debug+/debug+/debug:full/filealign:512/optimize-/out:obj\debug\LibraryOfModels.dll/ruleset:“C:\Program Files Files(x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Set\MinimumRecommendeRules.ruleset“/target:library/utf8output BuyMenuClass.cs CastleModel.cs ChatDTO.cs CollectionCombiner.cs Country.cs CurrentUser.cs decoration list items.cs GameDTO.cs MapTransform.cs MarketplaceModel.cs menufirstmanagemodel.cs NotifyBase.cs Player.cs popupcorpickermodel.cs popupetrainfomodel.cs PopUpModel.cs Properties\AssemblyInfo.cs rankingTO.cs RankingModel.cs ShieldGearModel.cs UnitModel.cs UserDTO.cs WarCalculations.cs“C:\Users\johann\AppData\Local\Temp.NETPortable,Version=v4.0,Profile=Profile158.AssemblyAttributes.cs”

我们可以看到两者之间的唯一区别是所使用的.NetFrameworks。一个版本为4.5.51650,另一个版本为4.6.01038

更新

看来最新的win 10 pc更新解决了这个问题
Grid RiskGrid = FindParentOfType<Grid>(ChampViewModelSel);
  StackTrace  "   at Microsoft.CSharp.RuntimeBinder.SymbolTable.GetOriginalTypeParameterType(Type t)\r\n   
    at Microsoft.CSharp.RuntimeBinder.SymbolTable.AreTypeParametersEquivalent(Type t1, Type t2)\r\n   
    at Microsoft.CSharp.RuntimeBinder.SymbolTable.LoadMethodTypeParameter(MethodSymbol parent, Type t)\r\n   
    at Microsoft.CSharp.RuntimeBinder.SymbolTable.LoadSymbolsFromType(Type originalType)\r\n   
    at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddMethodToSymbolTable(MemberInfo member, AggregateSymbol callingAggregate, MethodKindEnum kind)\r\n   
    at Microsoft.CSharp.RuntimeBinder.SymbolTable.AddNamesInInheritanceHierarchy(String name, BindingFlags flags, List 1 inheritance)\r\n   
    at Microsoft.CSharp.RuntimeBinder.SymbolTable.PopulateSymbolTableWithName(String name, IEnumerable 1 typeArguments, Type callingType)\r\n   
    at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.PopulateSymbolTableWithPayloadInformation(DynamicMetaObjectBinder payload, Type callingType, ArgumentObject[] arguments)\r\n  
    at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore(DynamicMetaObjectBinder payload, IEnumerable 1 parameters, DynamicMetaObject[] args, DynamicMetaObject& deferredBinding)\r\n
    at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind(DynamicMetaObjectBinder payload, IEnumerable 1 parameters, DynamicMetaObject[] args, DynamicMetaObject& deferredBinding)\r\n 
    at Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind(DynamicMetaObjectBinder action, RuntimeBinder binder, IEnumerable 1 args, IEnumerable 1 arginfos, DynamicMetaObject onBindingError)\r\n 
    at Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder.FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)\r\n
    at System.Dynamic.DynamicMetaObject.BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args)\r\n 
    at System.Dynamic.InvokeMemberBinder.Bind(DynamicMetaObject target, DynamicMetaObject[] args)\r\n
    at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection 1 parameters, LabelTarget returnLabel)\r\n
    at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite 1 site, Object[] args)\r\n 
    at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)\r\n
    at BC_Game.ViewModel.ChampionViewModel.FindParentOfType[T](DependencyObject o)\r\n 
    at BC_Game.ViewModel.ChampionViewModel.ManStart(ManipulationStartedEventArgs e)"    string
VisualTreeHelper.GetParent(o);