Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Unassigned: Model.tt template causes warnings in VB [1495]

$
0
0
Very minor issue. If you create an EDMX in a VB project (I used a Dynamic Data Entities Website and a model with 2 entities with a 1:* association between them), when the .tt files generate the .vb code you get the following 2 warnings from Model.tt:

Warning 1 Compiling transformation: Variable 'errors' is passed by reference before it has been assigned a value. A null reference exception could result at runtime. C:\Users\lajones\Documents\Visual Studio 2013\WebSites\DynamicDataEntitiesVB01\App_Code\Model.tt 616 1 DynamicDataEntitiesVB01
Warning 2 Compiling transformation: Variable 'lazyLoadingAttributeValue' is passed by reference before it has been assigned a value. A null reference exception could result at runtime. C:\Users\lajones\Documents\Visual Studio 2013\WebSites\DynamicDataEntitiesVB01\App_Code\Model.tt 670 1 DynamicDataEntitiesVB01

This is because VB is not good with out parameters - it thinks it's passing a parameter by ref instead and hence is worried that they could be used before they are initialized.

These warnings can be safely ignored as we will assign a value via the out parameter but it would be relatively simple to update the VB templates so that the 2 variables identified in the warnings above are assigned values (probably just Nothing) which would make these warnings go away.
Comments: Duplicate of https://entityframework.codeplex.com/workitem/1174

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>