Could not load file or assembly System.CodeDom
See original GitHub issueDescribe the bug I Updated from 0.3.1-beta to 0.5-beta and we got a exception in all our services ( linux/windows )
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at flowfact.services.attributes.ServiceRegister.<>c__DisplayClass3_0.<FindTypesByAttribute>b__1(Assembly s)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator2.ToList()
at flowfact.services.attributes.ServiceRegister.FindTypesByAttribute(Type[] types)
System.IO.FileNotFoundException: Could not load file or assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
System.IO.FileNotFoundException: Could not load file or assembly 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Runtime environment (please complete the following information):
- Instrumentation mode: manual
- Tracer version: 0.5.0-beta
- OS: Linux / Docker image ( microsoft/dotnet:2.1-runtime-deps-stretch-slim )
- CLR: .Net Core 2.1
Additional context i dont know what the exact problem is, but i think this lines below does produce the error with 0.3.1-beta everythings works fine ( already did the downgrade ), with 0.5-beta i can reproduce the exception above
private static List<(Type Type, object[] CustomAttributes)> FindTypesByAttribute(params Type[] types)
{
try
{
var allTypes = AppDomain.CurrentDomain.GetAssemblies()
.Where(s => !s.FullName.StartsWith("Microsoft") && !s.FullName.StartsWith("System."))
.Select(s => s.GetTypes()
.Select(type => (Type: type, CustomAttributes: type.GetCustomAttributes(true)))
.Where(z => z.CustomAttributes.Length > 0 && z.CustomAttributes.Any(t => types.Any(i => i == t.GetType())))
);
return allTypes.SelectMany(s => s).ToList();
}
catch (Exception ex)
{
Logger.Error(ex);
}
return null;
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Could not load file or assembly Microsoft.CodeAnalysis
Right click on your project >> Manage Nuget packages manager for solution >> Tap on Updates >> Update your 'Microsoft.CodeDom.Providers.
Read more >How to solve the error "Could not load file or assembly ...
This post will show you how to solve the error "Could not load file or assembly 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform ...
Read more >Could not load System.CodeDom
when run the application get this error: System.IO.FileNotFoundException: 'Could not load file or assembly 'System.CodeDom, Version=0.0.0.0, ...
Read more >Could Not Load File Or Assembly 'System.Runtime, ...
Could Not Load File Or Assembly 'System.Runtime, Version=6.0.0.0 · Right-click on the project and select Properties. · In the Properties window, ...
Read more >Asp.net runtime error: could not load file or assembly ...
Solution 1. Accept Solution Reject Solution. Check this: c# - The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I created this PR so it can be fixed in the next release of their library.
It looks like the error is caused by a
MsgPack.Cli
dependency. In v0.4.0, we updated theMsgPack.Cli
NuGet reference from 0.9.2 to 1.0.0 (see #158).MsgPack.Cli
has a reference toSystem.CodeDom
4.4.0 which is not included in the nuspec file, so it doesn’t show up in their NuGet package.This issue in their repo seems to be related.
In the short term, you can avoid the exception by skipping the MsgPack assembly in the LINQ query: