C# ‘dynamic’ cannot access properties from anonymous types declared in another assembly

I believe the problem is that the anonymous type is generated as internal, so the binder doesn’t really “know” about it as such. Try using ExpandoObject instead: public static dynamic GetValues() { dynamic expando = new ExpandoObject(); expando.Name = “Michael”; expando.Age = 20; return expando; } I know that’s somewhat ugly, but it’s the best … Read more

Found an unexpected Mach-O header code: 0x72613c21 in Xcode 7

Check two things for every framework: The Mach-O type of the framework (in Build Settings of the framework target) Whether you copy the framework by putting it in Build Phases -> Embed Frameworks (or Copy Bundle Resources as mentioned by a. brooks hollar) If the Mach-O type of the framework is “static library”, it should … Read more

Why does this (null || !TryParse) conditional result in “use of unassigned local variable”?

I am pretty sure this is a compiler bug. Nice find! Edit: it is not a bug, as Quartermeister demonstrates; dynamic might implement a weird true operator which might cause y to never be initialized. Here’s a minimal repro: class Program { static bool M(out int x) { x = 123; return true; } static … Read more

How to debug dynamically loaded JavaScript (with jQuery) in the browser’s debugger itself?

You can give your dynamically loaded script a name so that it shows in the Chrome/Firefox JavaScript debugger. To do this you place a comment at the end of the script: //# sourceURL=filename.js This file will then show in the “Sources” tab as filename.js. In my experience you can use ‘s in the name but … Read more

Extension method and dynamic object

To expand on Jon’s answer, the reason this doesn’t work is because in regular, non-dynamic code extension methods work by doing a full search of all the classes known to the compiler for a static class that has an extension method that matches. The search goes in order based on the namespace nesting and available … Read more

dynamic does not contain a definition for a property from a project reference

Jahamal’s answer doesn’t say why you get the error. The reason is that the anonymous class is internal to the assembly. Keyword dynamic doesn’t allow you to bypass member visibility. The solution is to replace the anonymous class with named public class. Here’s another good example explaining the reason and another possible solution. The reason … Read more

Dynamically Add C# Properties at Runtime

Have you taken a look at ExpandoObject? see: https://learn.microsoft.com/en-us/dotnet/api/system.dynamic.expandoobject From MSDN: The ExpandoObject class enables you to add and delete members of its instances at run time and also to set and get values of these members. This class supports dynamic binding, which enables you to use standard syntax like sampleObject.sampleMember instead of more complex … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)