Bug 57940 - Method `Assembly' not found in type `NInterpret.InterpretedClrType'.
Summary: Method `Assembly' not found in type `NInterpret.InterpretedClrType'.
Status: RESOLVED INVALID
Alias: None
Product: Live Player
Classification: Xamarin
Component: Mobile App ()
Version: 1.0.253
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-07-05 13:09 UTC by Wade
Modified: 2017-11-02 12:46 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Wade 2017-07-05 13:09:59 UTC
The method Assembly is not found on the type System.Reflection.TypeInfo.

This method is very useful when using reflection to automatically load types.

For instance, this code finds and loads all configuration types for the popular AutoMapper library

    var profiles = GetType()
        .Assembly()
        .DefinedTypes.Where(t => t.IsClass && typeof(Profile).GetTypeInfo().IsAssignableFrom(t))
        .ToList();
    var config = new MapperConfiguration(c =>
                 {
                     foreach (var pti in profiles)
                         c.AddProfile(pti.AsType());
                 });
    config.AssertConfigurationIsValid();

To reproduce, create a Forms project and the following code inthe App constr

    var a = GetType().Assembly();

The exact error is `Method `Assembly' not found in type `NInterpret.InterpretedClrType'.`
Comment 1 James Montemagno [MSFT] 2017-08-25 17:42:47 UTC
The code looks reproducible, however we really need small sample.
Comment 2 Wade 2017-08-28 05:30:30 UTC
To reproduce, create a Forms project and add the following code in the App constructor

    var a = GetType().Assembly();

The exact error is `Method `Assembly' not found in type `NInterpret.InterpretedClrType'.`
Comment 3 James Montemagno [MSFT] 2017-08-31 20:20:39 UTC
So, I am not sure where you put that code as that is not valid when I add it into my app.

I did this: var a = GetType().Assembly;

and it worked just fine... I am using shared projects here. This is what small samples are best to attach so we know exactly what you are doing.
Comment 4 Wade 2017-11-02 12:46:34 UTC
FreshIOC had included a static class under the System.Reflection namespace, leading me to believe it was an official API.