Sebazzz / SDammann.T4WPF

Strongly-typed navigation page generator T4-file
4 stars 0 forks source link

Does not work on Windows 8 RTM in Windows Store App #1

Open xperiandri opened 12 years ago

xperiandri commented 12 years ago

The error is here public _NavigationPageDestination WithQuery(object anonymousQueryStringSpecifier) { return WithQuery( anonymousQueryStringSpecifier.GetType() .GetProperties() .ToDictionary(p => p.Name, p => p.GetValue(anonymousQueryStringSpecifier, null))); }

Because of some changes in Reflection in .NET for WinRT

Now it looks something like anonymousQueryStringSpecifier.GetType().GetRuntimeProperties()

http://msdn.microsoft.com/en-us/library/windows/apps/br230302%28v=VS.85%29.aspx#reflection http://msdn.microsoft.com/en-us/library/windows/apps/hh535795(v=vs.85).aspx

Sebazzz commented 12 years ago

Confirmed. I don't have a Windows 8 test setup running right now, but I'Il look into it and try to find a solution.

Sebazzz commented 12 years ago

Please copy the contents of this file to your current tt file and verify if it works correctly for you. Thanks.

The file: https://github.com/Sebazzz/SDammann.T4WPF/blob/master/src/T4WPF.PhoneTestProject/StronglyTypedPageLinks.tt

xperiandri commented 12 years ago

No, it doesn't What you need is to check if it is Windows Store project and swap GetProperties() with GetRuntimeProperties()

Because in .NET 4.5 project for WPF you default version will still work. This change is necessary only for .NET for Windows Store applications profile

Sebazzz commented 12 years ago

I have modified the file. Please copy the contents to your current tt file and verify if this only does correctly work for you.

Thanks.

xperiandri commented 12 years ago

No, it doesn't. Because you have to check not for .NET 4.5 because there is no such property in windows store application project

It is a property group of my windows store project

Debug AnyCPU {70794A8C-9AED-4742-8524-EF5E9EEF0604} AppContainerExe Properties TeamTimer TeamTimer en-US 512 {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} TeamTimer.Metro_TemporaryKey.pfx SAK SAK SAK SAK 1

I think the key property in our case is AppContainerExe

And you needn't to invoke .GetTypeInfo().GetRuntimeProperties() Just .GetRuntimeProperties() is enough

Sebazzz commented 12 years ago

I assumed that checking for .NET 4.5 would be sufficient, but apparently not. I have no way of testing this, so I'm depending on you to for the test results. I have updated the file, please check if it is correct.