This project is read-only.

ConsoleClassifier sample app throws an exception

Topics: General
Jul 10, 2014 at 8:57 PM
Edited Jul 10, 2014 at 9:12 PM
I have installed VS 2014 CTP2 on a brand new Windows . When I run sample ConsoleClassifier it throws exception. Any idea what I need to do. In fact all samples in the samples solution throw exceptions. I am not able to run any of them. Please help.

This is the exception that I get:
Image

Regards,

Joginder Nahil

www.starprinttools.com
Jul 10, 2014 at 11:30 PM
We are working on updating the SDK and Samples for CTP2. Unfortunately they only work under CTP1 for now. Out of curiosity what is the InnerException contained in the AggregateException?
Jul 11, 2014 at 9:08 AM
I have an add-in to Visual Studio for source code printing in color. I think Roslyn can help me a lot to do the coloring task, so I am very keen to get the samples working to learn. When do you think that the samples will be ported to work on CTP2?

Here is the Exception stack:
_
System.Reflection.ReflectionTypeLoadException occurred
HResult=-2146232830
Message=Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Source=mscorlib
StackTrace:
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
   at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InnerCatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore[T,TMetadataView](String contractName)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports[T,TMetadataView](String contractName)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports[T,TMetadataView]()
   at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.<GetExports>b__6[TExtension,TMetadata](ExportKey _)
   at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue](ImmutableDictionary`2& location, TKey key, Func`2 valueFactory)
   at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.GetExports[TExtension,TMetadata]()
   at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.MefWorkspaceServices.<>c__DisplayClass0`1.<GetService>b__5(Type _)
   at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue](ImmutableDictionary`2& location, TKey key, Func`2 valueFactory)
   at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.MefWorkspaceServices.GetService[TWorkspaceService]()
   at Microsoft.CodeAnalysis.Workspace..ctor(HostServices host, String workspaceKind)
   at Microsoft.CodeAnalysis.CustomWorkspace..ctor(HostServices host, String workspaceKind)
   at Microsoft.CodeAnalysis.CustomWorkspace..ctor()
   at Program.<TestFormatterAndClassifierAsync>d__1.MoveNext() in X:\Dev\_Roslyn\Roslyn SDK Preview for Visual Studio 14 CTP1\Samples\CSharp\ConsoleClassifier\Program.cs:line 95
InnerException:
_

Regards,
Joginder Nahil
Jul 14, 2014 at 4:51 PM
Thanks - now take a look at the "LoaderExceptions" property of that InnerException to see what types are failing to load.

Also - just to confirm, is Microsoft.CodeAnalysis.CSharp.Workspaces.dll and/or Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll in the same directory as your output exe?
Jul 14, 2014 at 7:09 PM
Hi Kevin,

I just wanted to say that I am trying to run the Roslyn samples without any change to them. I installed VS CTP14 on a brand new 64-bit Window Pro and installed CTP 14. I have not installed any other software either or made any changes to the samples.

Can you guys run Roslyn samples on CTP 14?

_Here are the details as requested:

Loader Exceptions: {System.Exception[5]}
Message : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Source : mscorlib
Stack Trace :
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InnerCatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable1& exports)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable
1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable
1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore[T,TMetadataView](String contractName)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports[T,TMetadataView](String contractName)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsT,TMetadataView
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.<GetExports>b__6[TExtension,TMetadata](ExportKey _)
at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue](ImmutableDictionary2& location, TKey key, Func2 valueFactory)
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.GetExportsTExtension,TMetadata
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.MefWorkspaceServices.<>c__DisplayClass01.<GetService>b__5(Type _)
at System.Collections.Immutable.ImmutableInterlocked.GetOrAdd[TKey,TValue](ImmutableDictionary
2& location, TKey key, Func`2 valueFactory)
at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.MefWorkspaceServices.GetServiceTWorkspaceService
at Microsoft.CodeAnalysis.Workspace..ctor(HostServices host, String workspaceKind)
at Microsoft.CodeAnalysis.CustomWorkspace..ctor(HostServices host, String workspaceKind)
at Microsoft.CodeAnalysis.CustomWorkspace..ctor()
at Program.<TestFormatterAndClassifierAsync>d__1.MoveNext() in X:\Dev_Roslyn\Roslyn SDK Preview for Visual Studio 14 CTP1\Samples\CSharp\ConsoleClassifier\Program.cs:line 95

_Regards,
Joginder Nahil
Jul 21, 2014 at 11:47 AM
I just wanted to confirm that the Roslyn Samples including ConsoleClassifier work fine when Roslyn is run under Visual Studio 2013. The issue is to do with VS CTP14.

Regards,
Joginder Nahil